File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
tests/Doctrine/ODM/MongoDB/Tests/Proxy/Factory Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 99use Doctrine \ODM \MongoDB \Event \DocumentNotFoundEventArgs ;
1010use Doctrine \ODM \MongoDB \Events ;
1111use Doctrine \ODM \MongoDB \LockException ;
12+ use Doctrine \ODM \MongoDB \Proxy \InternalProxy ;
1213use Doctrine \ODM \MongoDB \Tests \BaseTestCase ;
1314use Documents \Cart ;
1415use Documents \DocumentWithUnmappedProperties ;
1516use MongoDB \Client ;
1617use MongoDB \Collection ;
1718use MongoDB \Database ;
1819use PHPUnit \Framework \MockObject \MockObject ;
20+ use ProxyManager \Proxy \GhostObjectInterface ;
1921
2022class ProxyFactoryTest extends BaseTestCase
2123{
@@ -80,10 +82,14 @@ private function createMockedDocumentManager(): DocumentManager
8082 public function testCreateProxyForDocumentWithUnmappedProperties (): void
8183 {
8284 $ proxy = $ this ->dm ->getReference (DocumentWithUnmappedProperties::class, '123 ' );
83- self ::assertInstanceOf (GhostObjectInterface::class, $ proxy );
85+ self ::assertTrue ( self :: isLazyObject ( $ proxy) );
8486
85- // Disable initialiser so we can access properties without initialising the object
86- $ proxy ->setProxyInitializer (null );
87+ // Disable initializer so we can access properties without initialising the object
88+ if ($ proxy instanceof InternalProxy) {
89+ $ proxy ->__setInitialized (true );
90+ } elseif ($ proxy instanceof GhostObjectInterface) {
91+ $ proxy ->setProxyInitializer (null );
92+ }
8793
8894 self ::assertSame ('bar ' , $ proxy ->foo );
8995 }
You can’t perform that action at this time.
0 commit comments