From 52fc8147b12225b73625f5791e7e3f83675196ae 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 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/Test/ConfigMysqlCacheDbTest.php b/tests/Test/ConfigMysqlCacheDbTest.php index e4d01955..257701a0 100644 --- a/tests/Test/ConfigMysqlCacheDbTest.php +++ b/tests/Test/ConfigMysqlCacheDbTest.php @@ -119,19 +119,28 @@ public function testLoadFixturesAndCheckBackup(): void */ public function testLoadFixturesCheckReferences(): void { - $this->markTestSkipped('This test is broken right now.'); $referenceRepository = $this->databaseTool->loadFixtures([ '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