Skip to content

Commit

Permalink
fix: testLoadFixturesCheckReferences
Browse files Browse the repository at this point in the history
  • Loading branch information
alexislefebvre committed Nov 2, 2023
1 parent 099d3ce commit 587c934
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/Test/ConfigMysqlCacheDbTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,24 @@ public function testLoadFixturesCheckReferences(): void
'Liip\Acme\Tests\App\DataFixtures\ORM\LoadUserData',
])->getReferenceRepository();

$this->assertCount(1, $referenceRepository->getReferences());
$references = (method_exists($referenceRepository, 'getReferencesByClass'))
// with getReferencesByClass(), references are grouped by class
? $referenceRepository->getReferencesByClass()['Liip\Acme\Tests\App\Entity\User']
: $referenceRepository->getReferences();

$this->assertCount(1, $references);

$referenceRepository = $this->databaseTool->loadFixtures([
'Liip\Acme\Tests\App\DataFixtures\ORM\LoadUserData',
'Liip\Acme\Tests\App\DataFixtures\ORM\LoadSecondUserData',
])->getReferenceRepository();

$this->assertCount(2, $referenceRepository->getReferences());
$references = (method_exists($referenceRepository, 'getReferencesByClass'))
// with getReferencesByClass(), references are grouped by class
? $referenceRepository->getReferencesByClass()['Liip\Acme\Tests\App\Entity\User']
: $referenceRepository->getReferences();

$this->assertCount(2, $references);
}

protected static function getKernelClass(): string
Expand Down

0 comments on commit 587c934

Please sign in to comment.