15
15
use ProxyManager \Proxy \LazyLoadingInterface ;
16
16
use ProxyManager \Proxy \ValueHolderInterface ;
17
17
use Symfony \Bridge \Doctrine \ManagerRegistry ;
18
+ use Symfony \Bridge \Doctrine \Tests \Fixtures \DummyManager ;
18
19
use Symfony \Bridge \ProxyManager \LazyProxy \PhpDumper \ProxyDumper ;
19
- use Symfony \Bridge \ProxyManager \Tests \LazyProxy \Dumper \PhpDumperTest ;
20
20
use Symfony \Component \DependencyInjection \ContainerBuilder ;
21
21
use Symfony \Component \DependencyInjection \ContainerInterface ;
22
22
use Symfony \Component \DependencyInjection \Dumper \PhpDumper ;
@@ -26,13 +26,20 @@ class ManagerRegistryTest extends TestCase
26
26
{
27
27
public static function setUpBeforeClass (): void
28
28
{
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 ' ]));
31
38
}
32
39
33
40
public function testResetService ()
34
41
{
35
- $ container = new \LazyServiceProjectServiceContainer ();
42
+ $ container = new \LazyServiceDoctrineBridgeContainer ();
36
43
37
44
$ registry = new TestManagerRegistry ('name ' , [], ['defaultManager ' => 'foo ' ], 'defaultConnection ' , 'defaultManager ' , 'proxyInterfaceName ' );
38
45
$ registry ->setTestContainer ($ container );
@@ -44,8 +51,8 @@ public function testResetService()
44
51
$ registry ->resetManager ();
45
52
46
53
$ 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 ));
49
56
}
50
57
51
58
/**
@@ -77,7 +84,7 @@ public function testResetServiceWillNotNestFurtherLazyServicesWithinEachOther()
77
84
78
85
$ service = $ container ->get ('foo ' );
79
86
80
- self ::assertInstanceOf (\stdClass ::class, $ service );
87
+ self ::assertInstanceOf (DummyManager ::class, $ service );
81
88
self ::assertInstanceOf (LazyLoadingInterface::class, $ service );
82
89
self ::assertInstanceOf (ValueHolderInterface::class, $ service );
83
90
self ::assertFalse ($ service ->isProxyInitialized ());
@@ -91,7 +98,7 @@ public function testResetServiceWillNotNestFurtherLazyServicesWithinEachOther()
91
98
$ service ->initializeProxy ();
92
99
93
100
$ wrappedValue = $ service ->getWrappedValueHolderValue ();
94
- self ::assertInstanceOf (\stdClass ::class, $ wrappedValue );
101
+ self ::assertInstanceOf (DummyManager ::class, $ wrappedValue );
95
102
self ::assertNotInstanceOf (LazyLoadingInterface::class, $ wrappedValue );
96
103
self ::assertNotInstanceOf (ValueHolderInterface::class, $ wrappedValue );
97
104
}
@@ -104,7 +111,7 @@ private function dumpLazyServiceProjectAsFilesServiceContainer()
104
111
105
112
$ container = new ContainerBuilder ();
106
113
107
- $ container ->register ('foo ' , \stdClass ::class)
114
+ $ container ->register ('foo ' , DummyManager ::class)
108
115
->setPublic (true )
109
116
->setLazy (true );
110
117
$ container ->compile ();
0 commit comments