8000 minor #53970 [PropertyAccess]  fix tests (xabbuh) · symfony/symfony@d352e98 · GitHub
[go: up one dir, main page]

Skip to content

Commit d352e98

Browse files
committed
minor #53970 [PropertyAccess]  fix tests (xabbuh)
This PR was merged into the 6.4 branch. Discussion ---------- [PropertyAccess]  fix tests | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT Commits ------- e8fcaf4 fix tests
2 parents 32d67d3 + e8fcaf4 commit d352e98

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function testGetValueThrowsExceptionIfUninitializedPropertyWithGetterOfAn
227227
$this->expectException(UninitializedPropertyException::class);
228228
$this->expectExceptionMessage('The method "Symfony\Component\PropertyAccess\Tests\Fixtures\UninitializedPrivateProperty@anonymous::getUninitialized()" returned "null", but expected type "array". Did you forget to initialize a property or to make the return type nullable using "?array"?');
229229

230-
$object = new class() extends \Symfony\Component\PropertyAccess\Tests\Fixtures\UninitializedPrivateProperty {
230+
$object = new class() extends UninitializedPrivateProperty {
231231
};
232232

233233
$this->propertyAccessor->getValue($object, 'uninitialized');
@@ -978,20 +978,6 @@ public function testGetValueGetterThrowsExceptionIfUninitializedWithoutLazyGhost
978978
$this->propertyAccessor->getValue(new UninitializedObjectProperty(), 'privateUninitialized');
979979
}
980980

981-
private function createUninitializedObjectPropertyGhost(): UninitializedObjectProperty
982-
{
983-
$class = 'UninitializedObjectPropertyGhost';
984-
985-
if (!class_exists($class)) {
986-
eval('class '.$class.ProxyHelper::generateLazyGhost(new \ReflectionClass(UninitializedObjectProperty::class)));
987-
}
988-
989-
$this->assertTrue(class_exists($class));
990-
991-
return $class::createLazyGhost(initializer: function ($instance) {
992-
});
993-
}
994-
995981
public function testGetValuePropertyThrowsExceptionIfUninitializedWithLazyGhost()
996982
{
997983
$this->expectException(UninitializedPropertyException::class);
@@ -1011,4 +997,22 @@ public function testGetValueGetterThrowsExceptionIfUninitializedWithLazyGhost()
1011997

1012998
$this->propertyAccessor->getValue($lazyGhost, 'privateUninitialized');
1013999
}
1000+
1001+
private function createUninitializedObjectPropertyGhost(): UninitializedObjectProperty
1002+
{
1003+
if (!class_exists(ProxyHelper::class)) {
1004+
$this->markTestSkipped(sprintf('Class "%s" is required to run this test.', ProxyHelper::class));
1005+
}
1006+
1007+
$class = 'UninitializedObjectPropertyGhost';
1008+
1009+
if (!class_exists($class)) {
1010+
eval('class '.$class.ProxyHelper::generateLazyGhost(new \ReflectionClass(UninitializedObjectProperty::class)));
1011+
}
1012+
1013+
$this->assertTrue(class_exists($class));
1014+
1015+
return $class::createLazyGhost(initializer: function ($instance) {
1016+
});
1017+
}
10141018
}

0 commit comments

Comments
 (0)
0