@@ -19,7 +19,7 @@ class Symfony extends HttpKernelBrowser
19
19
/**
20
20
* @var bool
21
21
*/
22
- private $ rebootable = true ;
22
+ private $ rebootable ;
23
23
24
24
/**
25
25
* @var bool
@@ -29,7 +29,7 @@ class Symfony extends HttpKernelBrowser
29
29
/**
30
30
* @var ContainerInterface
31
31
*/
32
- private $ container = null ;
32
+ private $ container ;
33
33
34
34
/**
35
35
* @var array
@@ -49,7 +49,7 @@ public function __construct(Kernel $kernel, array $services = [], bool $rebootab
49
49
$ this ->followRedirects (true );
50
50
$ this ->rebootable = $ rebootable ;
51
51
$ this ->persistentServices = $ services ;
52
- $ this ->container = $ this ->kernel -> getContainer ();
52
+ $ this ->container = $ this ->getContainer ();
53
53
$ this ->rebootKernel ();
54
54
}
55
55
@@ -86,10 +86,9 @@ public function rebootKernel(): void
86
86
}
87
87
}
88
88
89
- $ this ->kernel ->shutdown ();
90
- $ this ->kernel ->boot ();
89
+ $ this ->kernel ->reboot (null );
91
90
92
- $ this ->container = $ this ->kernel -> getContainer ();
91
+ $ this ->container = $ this ->getContainer ();
93
92
94
93
foreach ($ this ->persistentServices as $ serviceName => $ service ) {
95
94
try {
@@ -105,6 +104,16 @@ public function rebootKernel(): void
105
104
}
106
105
}
107
106
107
+ private function getContainer (): ?ContainerInterface
108
+ {
109
+ /** @var ContainerInterface $container */
110
+ $ container = $ this ->kernel ->getContainer ();
111
+ if ($ container ->has ('test.service_container ' )) {
112
+ $ container = $ container ->get ('test.service_container ' );
113
+ }
114
+ return $ container ;
115
+ }
116
+
108
117
private function getProfiler (): ?Profiler
109
118
{
110
119
if ($ this ->container ->has ('profiler ' )) {
0 commit comments