Skip to content

Commit

Permalink
fix: testLoadFixturesCheckReferences
Browse files Browse the repository at this point in the history
  • Loading branch information
alexislefebvre committed Nov 12, 2023
1 parent c13efc1 commit 00a5a97
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 @@ -124,14 +124,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 00a5a97

Please sign in to comment.