Unit tests

SVN:b1162[5530]
This commit is contained in:
Eric Espié
2018-03-26 15:02:24 +00:00
parent ac5d24a848
commit f0c8b348c6
2 changed files with 10 additions and 8 deletions

View File

@@ -37,7 +37,6 @@ use Hypervisor;
use lnkContactToFunctionalCI;
use MetaModel;
use Person;
use PHPUnit\Framework\TestCase;
use Server;
use Ticket;
use URP_UserProfile;
@@ -144,7 +143,7 @@ class ItopDataTestCase extends ItopTestCase
$oTicket = self::createObject('UserRequest', array(
'ref' => 'Ticket_'.$iNum,
'title' => 'BUG 789_'.$iNum,
'request_type' => 'incident',
//'request_type' => 'incident',
'description' => 'method UpdateImpactedItems() reconstruit le lnkContactToTicket donc impossible de rajouter des champs dans cette classe',
'org_id' => $this->getTestOrgId(),
));
@@ -168,7 +167,7 @@ class ItopDataTestCase extends ItopTestCase
$oTicket = self::createObject('UserRequest', array(
'ref' => 'Ticket_'.$iNum,
'title' => 'BUG 1161_'.$iNum,
'request_type' => 'incident',
//'request_type' => 'incident',
'description' => 'Add aggregate functions',
'time_spent' => $iTimeSpent,
'caller_id' => $iCallerId,
@@ -180,16 +179,20 @@ class ItopDataTestCase extends ItopTestCase
/**
* Create a Server in database
*
* @param int $iNum
* @param null $iRackUnit
*
* @return Server
* @throws Exception
* @throws \Exception
*/
protected function CreateServer($iNum)
protected function CreateServer($iNum, $iRackUnit = null)
{
/** @var Server $oServer */
$oServer = self::createObject('Server', array(
'name' => 'Server_'.$iNum,
'org_id' => $this->getTestOrgId(),
'nb_u' => $iRackUnit,
));
$this->debug("Created {$oServer->GetName()} ({$oServer->GetKey()})");
return $oServer;

View File

@@ -28,7 +28,6 @@ namespace Combodo\iTop\Test\UnitTest\iTopTickets;
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
use Exception;
use PHPUnit\Framework\TestCase;
/**
@@ -799,7 +798,7 @@ class ItopTicketTest extends ItopDataTestCase
$oServer2->GetKey() => 'manual');
$this->CheckFunctionalCIList($oTicket2, $aWaitedCIList);
$this->CheckContactList($oTicket2);
$this->assertEquals(5, $oTicket2->Get('functionalcis_list')->Count());
$this->assertEquals(2, $oTicket2->Get('functionalcis_list')->Count());
$this->assertEquals(1, $oTicket2->Get('contacts_list')->Count());
// The first ticket is not impacted
@@ -910,7 +909,7 @@ class ItopTicketTest extends ItopDataTestCase
$oServer2->GetKey() => 'manual');
$this->CheckFunctionalCIList($oTicket2, $aWaitedCIList);
$this->CheckContactList($oTicket2);
$this->assertEquals(6, $oTicket2->Get('functionalcis_list')->Count());
$this->assertEquals(3, $oTicket2->Get('functionalcis_list')->Count());
$this->assertEquals(1, $oTicket2->Get('contacts_list')->Count());
// The first ticket is not impacted