From 00a5a9744c5afd066a53f0230fb9b835239c8721 Mon Sep 17 00:00:00 2001 From: Alexis Lefebvre Date: Thu, 2 Nov 2023 21:08:22 +0100 Subject: [PATCH] fix: testLoadFixturesCheckReferences --- tests/Test/ConfigMysqlCacheDbTest.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/Test/ConfigMysqlCacheDbTest.php b/tests/Test/ConfigMysqlCacheDbTest.php index e4d01955..4a43d984 100644 --- a/tests/Test/ConfigMysqlCacheDbTest.php +++ b/tests/Test/ConfigMysqlCacheDbTest.php @@ -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