File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818use Behat \Gherkin \Node \TableNode ;
1919use GraphQL \Error \Error ;
2020use PHPUnit \Framework \Assert ;
21+ use Psr \Container \ContainerInterface ;
2122use Symfony \Bundle \FrameworkBundle \Console \Application ;
2223use Symfony \Component \Console \Command \Command ;
2324use Symfony \Component \Console \Tester \CommandTester ;
@@ -34,7 +35,9 @@ final class CommandContext implements Context
3435
3536 private ?CommandTester $ commandTester = null ;
3637
37- public function __construct (private KernelInterface $ kernel )
38+ private ?KernelInterface $ kernel = null ;
39+
40+ public function __construct (private readonly ContainerInterface $ driverContainer )
3841 {
3942 }
4043
@@ -92,6 +95,10 @@ public function getApplication(): Application
9295 return $ this ->application ;
9396 }
9497
98+ if (null === $ this ->kernel ) {
99+ $ this ->kernel = $ this ->driverContainer ->get ('kernel ' );
100+ }
101+
95102 $ this ->application = new Application ($ this ->kernel );
96103
97104 return $ this ->application ;
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ services:
33 autowire : true
44 autoconfigure : true
55
6- ApiPlatform\Tests\Behat\CommandContext : ~
6+ ApiPlatform\Tests\Behat\CommandContext :
7+ $driverContainer : ' @behat.driver.service_container'
78 ApiPlatform\Tests\Behat\DoctrineContext :
89 $doctrine : ' @doctrine_mongodb'
910 ApiPlatform\Tests\Behat\HttpCacheContext : ~
Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ services:
44 autowire : true
55 autoconfigure : true
66
7- ApiPlatform\Tests\Behat\CommandContext : ~
7+ ApiPlatform\Tests\Behat\CommandContext :
8+ $driverContainer : ' @behat.driver.service_container'
89 ApiPlatform\Tests\Behat\DoctrineContext :
910 $doctrine : ' @doctrine'
1011 ApiPlatform\Tests\Behat\HttpCacheContext : ~
You can’t perform that action at this time.
0 commit comments