File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010class IntegrationTest extends KernelTestCase
1111{
12- public function testServiceWiring ()
12+ private static function getInspectorService (): Inspector
1313 {
1414 self ::bootKernel (['environment ' => 'test ' ]);
1515
16- $ inspectorService = static ::getContainer ()->get (Inspector::class);
16+ // static::getContainer() was added in Symfony 5.3; fall back to
17+ // the deprecated self::$container for older versions.
18+ if (method_exists (static ::class, 'getContainer ' )) {
19+ return static ::getContainer ()->get (Inspector::class);
20+ }
21+
22+ return self ::$ container ->get (Inspector::class);
23+ }
24+
25+ public function testServiceWiring ()
26+ {
27+ $ inspectorService = self ::getInspectorService ();
1728
1829 $ this ->assertInstanceOf (Inspector::class, $ inspectorService );
1930 }
2031
2132 public function testServiceWiringWithConfiguration ()
2233 {
23- self ::bootKernel (['environment ' => 'test ' ]);
24-
25- $ inspectorService = static ::getContainer ()->get (Inspector::class);
34+ $ inspectorService = self ::getInspectorService ();
2635
2736 $ this ->assertFalse ($ inspectorService ->hasTransaction ());
2837 }
You can’t perform that action at this time.
0 commit comments