ci: fix by create 10 URs in CI env

This commit is contained in:
odain
2025-12-30 12:27:36 +01:00
parent afdfb2acf1
commit 346daa3ccc

View File

@@ -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');