mirror of
https://github.com/Combodo/iTop.git
synced 2026-09-21 17:10:00 +02:00
N°9934 - OQL with magic field (#1011)
This commit is contained in:
41
tests/php-unit-tests/unitary-tests/core/OQLResolverTest.php
Normal file
41
tests/php-unit-tests/unitary-tests/core/OQLResolverTest.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2026 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Test\UnitTest\Core;
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopCustomDatamodelTestCase;
|
||||
use DBObjectSet;
|
||||
use DBSearch;
|
||||
use MetaModel;
|
||||
|
||||
class OQLResolverTest extends ItopCustomDatamodelTestCase
|
||||
{
|
||||
public function GetDatamodelDeltaAbsPath(): string
|
||||
{
|
||||
return __DIR__.'/Delta/delta_oql_resolver.xml';
|
||||
}
|
||||
|
||||
public function testQueryOnMagicalFields()
|
||||
{
|
||||
// Given
|
||||
$sObjectKey = $this->GivenObjectInDB('OQLResolverChild', ['name' => 'toto', 'status' => 'new']);
|
||||
$oObject = MetaModel::GetObject('OQLResolverChild', $sObjectKey);
|
||||
|
||||
// When actions ApplyStimulus then next action fails
|
||||
$sFilter = "SELECT OQLResolverChild WHERE ISNULL(cumulatedpending_laststart)";
|
||||
$oSearch = DBSearch::FromOQL($sFilter);
|
||||
|
||||
$oSet = new DBObjectSet($oSearch);
|
||||
$oSet->OptimizeColumnLoad(['OQLResolverChild' => ['cumulatedpending']]);
|
||||
|
||||
$oActual = $oSet->Fetch();
|
||||
|
||||
// Then
|
||||
// Check status...
|
||||
$this->assertEquals($oObject->Get('name'), $oActual->Get('name'), 'The query should have returned the object');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user