diff --git a/tests/php-unit-tests/unitary-tests/core/DBObject/DBObjectSetTest.php b/tests/php-unit-tests/unitary-tests/core/DBObject/DBObjectSetTest.php index 3a8085443..2a74b6908 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBObject/DBObjectSetTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBObject/DBObjectSetTest.php @@ -4,12 +4,28 @@ use Combodo\iTop\Test\UnitTest\ItopDataTestCase; class DBObjectSetTest extends ItopDataTestCase { + public const USE_TRANSACTION = true; + + protected function setUp(): void + { + parent::setUp(); // TODO: Change the autogenerated stub + $this->CreateURs(); + } + protected function tearDown(): void { CMDBSource::TriggerExceptionWhenSqlQuery(null); parent::tearDown(); // TODO: Change the autogenerated stub } + private function CreateURs() + { + $this->CreateTestOrganization(); + for ($i = 0; $i < 10; $i++) { + $this->CreateTicket($i); + } + } + public function testCount() { $oSearch = DBObjectSearch::FromOQL_AllData("SELECT UserRequest"); @@ -20,7 +36,7 @@ class DBObjectSetTest extends ItopDataTestCase $this->assertEquals($iCount, $oSet->Count()); $this->assertEquals($iCount, $oSet->CountWithLimit(0)); $this->assertTrue($oSet->CountExceeds(0)); - + //no DB SQL query: exception will be raised after here CMDBSource::TriggerExceptionWhenSqlQuery(__METHOD__.' :'.__LINE__); $this->assertEquals($iCount, $oSet->Count(), 'should use cache and not call DB again');