1515use ProxyManager \Proxy \LazyLoadingInterface ;
1616use ProxyManager \Proxy \ValueHolderInterface ;
1717use Symfony \Bridge \Doctrine \ManagerRegistry ;
18+ use Symfony \Bridge \Doctrine \Tests \Fixtures \DummyManager ;
1819use Symfony \Bridge \ProxyManager \LazyProxy \PhpDumper \ProxyDumper ;
19- use Symfony \Bridge \ProxyManager \Tests \LazyProxy \Dumper \PhpDumperTest ;
2020use Symfony \Component \DependencyInjection \ContainerBuilder ;
2121use Symfony \Component \DependencyInjection \ContainerInterface ;
2222use Symfony \Component \DependencyInjection \Dumper \PhpDumper ;
@@ -26,13 +26,20 @@ class ManagerRegistryTest extends TestCase
2626{
2727 public static function setUpBeforeClass (): void
2828 {
29- $ test = new PhpDumperTest ();
30- $ test ->testDumpContainerWithProxyServiceWillShareProxies ();
29+ $ container = new ContainerBuilder ();
30+
31+ $ container ->register ('foo ' , DummyManager::class)->setPublic (true );
32+ $ container ->getDefinition ('foo ' )->setLazy (true );
33+ $ container ->compile ();
34+
35+ $ dumper = new PhpDumper ($ container );
36+ $ dumper ->setProxyDumper (new ProxyDumper ());
37+ eval ('?> ' .$ dumper ->dump (['class ' => 'LazyServiceDoctrineBridgeContainer ' ]));
3138 }
3239
3340 public function testResetService ()
3441 {
35- $ container = new \LazyServiceProjectServiceContainer ();
42+ $ container = new \LazyServiceDoctrineBridgeContainer ();
3643
3744 $ registry = new TestManagerRegistry ('name ' , [], ['defaultManager ' => 'foo ' ], 'defaultConnection ' , 'defaultManager ' , 'proxyInterfaceName ' );
3845 $ registry ->setTestContainer ($ container );
@@ -44,8 +51,8 @@ public function testResetService()
4451 $ registry ->resetManager ();
4552
4653 $ this ->assertSame ($ foo , $ container ->get ('foo ' ));
47- $ this ->assertInstanceOf (\stdClass ::class, $ foo );
48- $ this ->assertFalse (property_exists ($ foo, ' bar ' ));
54+ $ this ->assertInstanceOf (DummyManager ::class, $ foo );
55+ $ this ->assertFalse (isset ($ foo-> bar ));
4956 }
5057
5158 /**
@@ -77,7 +84,7 @@ public function testResetServiceWillNotNestFurtherLazyServicesWithinEachOther()
7784
7885 $ service = $ container ->get ('foo ' );
7986
80- self ::assertInstanceOf (\stdClass ::class, $ service );
87+ self ::assertInstanceOf (DummyManager ::class, $ service );
8188 self ::assertInstanceOf (LazyLoadingInterface::class, $ service );
8289 self ::assertInstanceOf (ValueHolderInterface::class, $ service );
8390 self ::assertFalse ($ service ->isProxyInitialized ());
@@ -91,7 +98,7 @@ public function testResetServiceWillNotNestFurtherLazyServicesWithinEachOther()
9198 $ service ->initializeProxy ();
9299
93100 $ wrappedValue = $ service ->getWrappedValueHolderValue ();
94- self ::assertInstanceOf (\stdClass ::class, $ wrappedValue );
101+ self ::assertInstanceOf (DummyManager ::class, $ wrappedValue );
95102 self ::assertNotInstanceOf (LazyLoadingInterface::class, $ wrappedValue );
96103 self ::assertNotInstanceOf (ValueHolderInterface::class, $ wrappedValue );
97104 }
@@ -104,7 +111,7 @@ private function dumpLazyServiceProjectAsFilesServiceContainer()
104111
105112 $ container = new ContainerBuilder ();
106113
107- $ container ->register ('foo ' , \stdClass ::class)
114+ $ container ->register ('foo ' , DummyManager ::class)
108115 ->setPublic (true )
109116 ->setLazy (true );
110117 $ container ->compile ();
0 commit comments