14
14
use PHPUnit \Framework \TestCase ;
15
15
use Symfony \Component \DependencyInjection \ContainerInterface ;
16
16
use Symfony \Component \HttpKernel \KernelInterface ;
17
- use Symfony \Contracts \Service \ResetInterface ;
18
17
19
18
/**
20
19
* KernelTestCase is the base class for tests needing a Kernel.
@@ -39,8 +38,6 @@ abstract class KernelTestCase extends TestCase
39
38
40
39
protected static $ booted = false ;
41
40
42
- private static $ kernelContainer ;
43
-
44
41
private function doTearDown ()
45
42
{
46
43
static ::ensureKernelShutdown ();
@@ -77,11 +74,12 @@ protected static function bootKernel(array $options = [])
77
74
{
78
75
static ::ensureKernelShutdown ();
79
76
80
- static ::$ kernel = static ::createKernel ($ options );
81
- static ::$ kernel ->boot ();
77
+ $ kernel = static ::createKernel ($ options );
78
+ $ kernel ->boot ();
79
+ self ::$ kernel = $ kernel ;
82
80
static ::$ booted = true ;
83
81
84
- self :: $ kernelContainer = $ container = static ::$ kernel ->getContainer ();
82
+ $ container = static ::$ kernel ->getContainer ();
85
83
static ::$ container = $ container ->has ('test.service_container ' ) ? $ container ->get ('test.service_container ' ) : $ container ;
86
84
87
85
return static ::$ kernel ;
@@ -132,14 +130,11 @@ protected static function createKernel(array $options = [])
132
130
protected static function ensureKernelShutdown ()
133
131
{
134
132
if (null !== static ::$ kernel ) {
133
+ static ::$ kernel ->boot ();
135
134
static ::$ kernel ->shutdown ();
136
135
static ::$ booted = false ;
137
136
}
138
137
139
- if (self ::$ kernelContainer instanceof ResetInterface) {
140
- self ::$ kernelContainer ->reset ();
141
- }
142
-
143
- static ::$ container = self ::$ kernelContainer = null ;
138
+ static ::$ container = null ;
144
139
}
145
140
}
0 commit comments