@@ -122,18 +122,13 @@ public function testSkipAbstractClassesOnGeneration(): void
122122 #[Group('DDC-2432 ' )]
123123 public function testFailedProxyLoadingDoesNotMarkTheProxyAsInitialized (): void
124124 {
125- if ($ this ->emMock ->getConfiguration ()->isNativeLazyObjectsEnabled ()) {
126- self ::markTestSkipped ('This test is not relevant when native lazy objects are enabled ' );
127- }
128-
129125 $ persister = $ this ->getMockBuilder (BasicEntityPersister::class)
130126 ->onlyMethods (['load ' ])
131127 ->disableOriginalConstructor ()
132128 ->getMock ();
133129 $ this ->uowMock ->setEntityPersister (ECommerceFeature::class, $ persister );
134130
135131 $ proxy = $ this ->proxyFactory ->getProxy (ECommerceFeature::class, ['id ' => 42 ]);
136- assert ($ proxy instanceof Proxy);
137132
138133 $ persister
139134 ->expects (self ::atLeastOnce ())
@@ -146,24 +141,31 @@ public function testFailedProxyLoadingDoesNotMarkTheProxyAsInitialized(): void
146141 } catch (EntityNotFoundException ) {
147142 }
148143
149- self ::assertFalse ($ proxy-> __isInitialized () );
144+ self ::assertUninitializedLazyObject ($ proxy );
150145 }
151146
152- #[Group('DDC-2432 ' )]
153- public function testFailedProxyCloningDoesNotMarkTheProxyAsInitialized (): void
147+ private static function assertUninitializedLazyObject (object $ proxy ): void
154148 {
155- if ($ this ->emMock ->getConfiguration ()->isNativeLazyObjectsEnabled ()) {
156- self ::markTestSkipped ('This test is not relevant when native lazy objects are enabled ' );
149+ if ($ proxy instanceof Proxy) {
150+ self ::assertFalse ($ proxy ->__isInitialized ());
151+
152+ return ;
157153 }
158154
155+ $ reflectionClass = new ReflectionClass ($ proxy );
156+ self ::assertTrue ($ reflectionClass ->isUninitializedLazyObject ($ proxy ));
157+ }
158+
159+ #[Group('DDC-2432 ' )]
160+ public function testFailedProxyCloningDoesNotMarkTheProxyAsInitialized (): void
161+ {
159162 $ persister = $ this ->getMockBuilder (BasicEntityPersister::class)
160163 ->onlyMethods (['load ' , 'getClassMetadata ' ])
161164 ->disableOriginalConstructor ()
162165 ->getMock ();
163166 $ this ->uowMock ->setEntityPersister (ECommerceFeature::class, $ persister );
164167
165168 $ proxy = $ this ->proxyFactory ->getProxy (ECommerceFeature::class, ['id ' => 42 ]);
166- assert ($ proxy instanceof Proxy);
167169
168170 $ persister
169171 ->expects (self ::atLeastOnce ())
@@ -177,7 +179,7 @@ public function testFailedProxyCloningDoesNotMarkTheProxyAsInitialized(): void
177179 } catch (EntityNotFoundException ) {
178180 }
179181
180- self ::assertFalse ($ proxy-> __isInitialized () );
182+ self ::assertUninitializedLazyObject ($ proxy );
181183 }
182184
183185 public function testProxyClonesParentFields (): void
0 commit comments