Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7f19b18

Browse filesBrowse files
[DoctrineBridge] Adjust non-legacy tests
1 parent 561d4a0 commit 7f19b18
Copy full SHA for 7f19b18

File tree

Expand file treeCollapse file tree

4 files changed

+13
-11
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+13
-11
lines changed

‎src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ public function refreshUser(UserInterface $user): UserInterface
100100

101101
if ($refreshedUser instanceof Proxy && !$refreshedUser->__isInitialized()) {
102102
$refreshedUser->__load();
103+
} elseif (\PHP_VERSION_ID >= 80400 && ($r = new \ReflectionClass($refreshedUser))->isUninitializedLazyObject($refreshedUser)) {
104+
$r->initializeLazyObject($refreshedUser);
103105
}
104106

105107
return $refreshedUser;

‎src/Symfony/Bridge/Doctrine/Tests/DoctrineTestHelper.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/DoctrineTestHelper.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public static function createTestEntityManager(?Configuration $config = null): E
4747
$config ??= self::createTestConfiguration();
4848
$eventManager = new EventManager();
4949

50+
if (\PHP_VERSION_ID >= 80400) {
51+
$config->enableNativeLazyObjects(true);
52+
}
53+
5054
return new EntityManager(DriverManager::getConnection($params, $config, $eventManager), $config, $eventManager);
5155
}
5256

‎src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@ public function testRefreshInvalidUser()
136136
$provider->refreshUser($user2);
137137
}
138138

139-
/**
140-
* @group legacy
141-
*/
142139
public function testSupportProxy()
143140
{
144141
$em = DoctrineTestHelper::createTestEntityManager();
@@ -205,9 +202,6 @@ public function testPasswordUpgrades()
205202
$provider->upgradePassword($user, 'foobar');
206203
}
207204

208-
/**
209-
* @group legacy
210-
*/
211205
public function testRefreshedUserProxyIsLoaded()
212206
{
213207
$em = DoctrineTestHelper::createTestEntityManager();
@@ -225,8 +219,13 @@ public function testRefreshedUserProxyIsLoaded()
225219
$provider = new EntityUserProvider($this->getManager($em), User::class);
226220
$refreshedUser = $provider->refreshUser($user);
227221

228-
$this->assertInstanceOf(Proxy::class, $refreshedUser);
229-
$this->assertTrue($refreshedUser->__isInitialized());
222+
if (\PHP_VERSION_ID >= 80400) {
223+
$this->assertFalse((new \ReflectionClass(User::class))->isUninitializedLazyObject($refreshedUser));
224+
$this->assertSame('user1', $refreshedUser->name);
225+
} else {
226+
$this->assertInstanceOf(Proxy::class, $refreshedUser);
227+
$this->assertTrue($refreshedUser->__isInitialized());
228+
}
230229
}
231230

232231
private function getManager($em, $name = null)

‎src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ public static function provideUniquenessConstraints(): iterable
164164
yield 'Named arguments' => [new UniqueEntity(message: 'myMessage', fields: ['name'], em: 'foo')];
165165
}
166166

167-
/**
168-
* @group legacy
169-
*/
170167
public function testValidateEntityWithPrivatePropertyAndProxyObject()
171168
{
172169
$entity = new SingleIntIdWithPrivateNameEntity(1, 'Foo');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.