From 587c934dfbc99a3d1e5ff0268ac2a8aeec310945 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 1beac3ee..257701a0 100644 --- a/tests/Test/ConfigMysqlCacheDbTest.php +++ b/tests/Test/ConfigMysqlCacheDbTest.php @@ -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