diff --git a/test/ItopDataTestCase.php b/test/ItopDataTestCase.php index aa11709553..5a7b58e19f 100644 --- a/test/ItopDataTestCase.php +++ b/test/ItopDataTestCase.php @@ -453,9 +453,9 @@ class ItopDataTestCase extends ItopTestCase $oUserProfile = new URP_UserProfile(); $oUserProfile->Set('profileid', $iProfileId); $oUserProfile->Set('reason', 'UNIT Tests'); - /** @var DBObjectSet $oSet */ + /** @var \ormLinkSet $oSet */ $oSet = $oUser->Get('profile_list'); - $oSet->AddObject($oUserProfile); + $oSet->AddItem($oUserProfile); $oUser = $this->updateObject('UserLocal', $oUser->GetKey(), array( 'profile_list' => $oSet, )); diff --git a/test/core/DBObjectTest.php b/test/core/DBObjectTest.php index db59fc8708..9a51649d62 100644 --- a/test/core/DBObjectTest.php +++ b/test/core/DBObjectTest.php @@ -254,7 +254,7 @@ class DBObjectTest extends ItopDataTestCase static::assertDBQueryCount(0, function() use (&$oObject){ $oObject = \MetaModel::NewObject('Person', ['name' => 'Foo', 'first_name' => 'John', 'org_id' => 3, 'location_id' => 2]); }); - static::assertDBQueryCount(28, function() use (&$oObject) { + static::assertDBQueryCount(26, function() use (&$oObject) { $oObject->DBInsertNoReload(); }); $sClass = get_class($oObject); @@ -304,7 +304,7 @@ class DBObjectTest extends ItopDataTestCase static::assertDBQueryCount(0, function() use (&$oPerson){ $oPerson = MetaModel::NewObject('Person', ['name' => 'Foo', 'first_name' => 'John', 'org_id' => 3, 'location_id' => 2]); }); - static::assertDBQueryCount(28, function() use (&$oPerson) { + static::assertDBQueryCount(26, function() use (&$oPerson) { $oPerson->DBInsertNoReload(); }); $sPersonClass = get_class($oPerson); @@ -326,7 +326,7 @@ class DBObjectTest extends ItopDataTestCase // $fItopStarted = microtime(true); // ExecutionKPI::EnableDuration(2); // $oKPI = new ExecutionKPI(); - static::assertDBQueryCount(92, function() use (&$oTeam) { + static::assertDBQueryCount(89, function() use (&$oTeam) { $oTeam->DBInsertNoReload(); }); // $oKPI->ComputeAndReport('Team DBInsertNoReload'); diff --git a/test/webservices/RestTest.php b/test/webservices/RestTest.php index d71cefa86d..ebf38f584c 100644 --- a/test/webservices/RestTest.php +++ b/test/webservices/RestTest.php @@ -22,11 +22,11 @@ class RestTest extends ItopDataTestCase const MODE = [ 'JSONDATA_AS_STRING' => 0, 'JSONDATA_AS_FILE' => 1 , 'NO_JSONDATA' => 2 ]; private $sTmpFile = ""; - /** @var int $iJsonDataMode */ - private $sJsonDataMode; private $sUrl; private $sLogin; private $sPassword = "Iuytrez9876543ç_è-("; + /** @var int $iJsonDataMode */ + private int $iJsonDataMode; /** * @throws Exception @@ -67,26 +67,27 @@ class RestTest extends ItopDataTestCase //create ticket $description = date('dmY H:i:s'); - $sOuputJson = $this->CreateTicketViaApi($description); - $aJson = json_decode($sOuputJson, true); + $sOutputJson = $this->CreateTicketViaApi($description); + $this->debug("Output: '$sOutputJson'"); + $aJson = json_decode($sOutputJson, true); if ($this->iJsonDataMode === self::MODE['NO_JSONDATA']){ - $this->assertContains("3", "".$aJson['code'], $sOuputJson); - $this->assertContains("Error: Missing parameter 'json_data'", "".$aJson['message'], $sOuputJson); + $this->assertContains("3", "".$aJson['code'], $sOutputJson); + $this->assertContains("Error: Missing parameter 'json_data'", "".$aJson['message'], $sOutputJson); return; } - $this->assertContains("0", "".$aJson['code'], $sOuputJson); + $this->assertContains("0", "".$aJson['code'], $sOutputJson); $sUserRequestKey = $this->array_key_first($aJson['objects']); $this->assertContains('UserRequest::', $sUserRequestKey); $iId = $aJson['objects'][$sUserRequestKey]['key']; $sExpectedJsonOuput=<<assertEquals($sExpectedJsonOuput, $sOuputJson); + $this->assertEquals($sExpectedJsonOuput, $sOutputJson); $sExpectedJsonOuput=<<$description<\/p>"}}},"code":0,"message":"Found: 1"} +{"objects":{"UserRequest::$iId":{"code":0,"message":"","class":"UserRequest","key":$iId,"fields":{"id":$iId,"description":"

$description<\/p>"}}},"code":0,"message":"Found: 1"} JSON; $this->assertEquals($sExpectedJsonOuput, $this->GetTicketViaRest($iId));