Skip to content

Commit c9a8c6f

Browse files
nicolas-grekasostrolucky
authored andcommitted
Fix tests with Symfony 7.3/PHP 8.4
1 parent faf411c commit c9a8c6f

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

tests/RegistryTest.php

+18-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
use function assert;
1919
use function interface_exists;
2020

21+
use const PHP_VERSION_ID;
22+
2123
class RegistryTest extends TestCase
2224
{
2325
public function testGetDefaultConnectionName(): void
@@ -116,7 +118,10 @@ public function testResetUnknownEntityManager(): void
116118
$registry->resetManager('default');
117119
}
118120

119-
/** @group legacy */
121+
/**
122+
* @group legacy
123+
* @requires PHP < 8.4
124+
*/
120125
public function testReset(): void
121126
{
122127
if (! interface_exists(EntityManagerInterface::class)) {
@@ -146,6 +151,7 @@ public function testReset(): void
146151
$registry->reset();
147152
}
148153

154+
/** @requires PHP < 8.4 */
149155
public function testResetLazyObject(): void
150156
{
151157
if (! interface_exists(EntityManagerInterface::class) || ! interface_exists(LazyObjectInterface::class)) {
@@ -166,6 +172,11 @@ public function testResetLazyObject(): void
166172
(new Registry($container, [], $entityManagers, 'default', 'default'))->reset();
167173
}
168174

175+
/**
176+
* The legacy group should be removed after https://github.com/doctrine/orm/pull/11853 is merged
177+
*
178+
* @group legacy
179+
*/
169180
public function testIdentityMapsStayConsistentAfterReset(): void
170181
{
171182
if (! interface_exists(EntityManagerInterface::class)) {
@@ -178,11 +189,15 @@ public function testIdentityMapsStayConsistentAfterReset(): void
178189
$container = $kernel->getContainer();
179190
$registry = $container->get('doctrine');
180191
$entityManager = $container->get('doctrine.orm.default_entity_manager');
181-
$repository = $entityManager->getRepository(TestCustomClassRepoEntity::class);
182192

183-
$this->assertInstanceOf(interface_exists(LazyObjectInterface::class) ? LazyObjectInterface::class : ProxyInterface::class, $entityManager);
193+
if (PHP_VERSION_ID < 80400) {
194+
$this->assertInstanceOf(interface_exists(LazyObjectInterface::class) ? LazyObjectInterface::class : ProxyInterface::class, $entityManager);
195+
}
196+
184197
assert($entityManager instanceof EntityManagerInterface);
185198
assert($registry instanceof Registry);
199+
200+
$repository = $entityManager->getRepository(TestCustomClassRepoEntity::class);
186201
assert($repository instanceof TestCustomClassRepoRepository);
187202

188203
$entity = new TestCustomClassRepoEntity();

0 commit comments

Comments
 (0)