File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,24 @@ public function getClient()
7474 */
7575 public function getContainer ()
7676 {
77- return self ::$ kernel ->getContainer ();
77+ return $ this ->getKernel ()->getContainer ();
78+ }
79+
80+ /**
81+ * Ensures the kernel is available.
82+ *
83+ * @return \Symfony\Component\HttpKernel\KernelInterface
84+ */
85+ public function getKernel ()
86+ {
87+ if (null === self ::$ kernel ) {
88+ self ::$ kernel = parent ::bootKernel ();
89+ }
90+ if (!self ::$ kernel ->getContainer ()) {
91+ self ::$ kernel ->boot ();
92+ }
93+
94+ return self ::$ kernel ;
7895 }
7996
8097 /**
Original file line number Diff line number Diff line change @@ -61,6 +61,11 @@ public function testGetContainer()
6161 $ this ->assertEquals ($ this ->container , $ this ->testCase ->getContainer ());
6262 }
6363
64+ public function testGetKernel ()
65+ {
66+ $ this ->assertInstanceOf (KernelInterface::class, $ this ->testCase ->getKernel ());
67+ }
68+
6469 public function provideTestDb ()
6570 {
6671 return [
You can’t perform that action at this time.
0 commit comments