Skip to content

Commit c31e10f

Browse files
committed
fix
1 parent 08fdd0b commit c31e10f

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

tests/Behat/CommandContext.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Behat\Gherkin\Node\TableNode;
1919
use GraphQL\Error\Error;
2020
use PHPUnit\Framework\Assert;
21+
use Psr\Container\ContainerInterface;
2122
use Symfony\Bundle\FrameworkBundle\Console\Application;
2223
use Symfony\Component\Console\Command\Command;
2324
use 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;

tests/Fixtures/app/config/config_behat_mongodb.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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: ~

tests/Fixtures/app/config/config_behat_orm.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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: ~

0 commit comments

Comments
 (0)