liip / LiipFunctionalTestBundle

Some helper classes for writing functional tests in Symfony
http://liip.ch
MIT License
640 stars 181 forks source link

Regression in getContainer with symfony 5.3 #592

Closed biozshock closed 2 years ago

biozshock commented 2 years ago

After the fix #584 there is no possibility to test runCommand with $reuseKernel = true when using symfony 5.3+.

Preconditions

  1. Use symfony 5.4
  2. Use runCommand test.

When there is a $this->getContainer() call before the runCommand it's not possible to reuse same kernel. In the following code there is no possibility to reuse kernel created by getContainer.

$client = $this->createMock(Client::class);

$this->getContainer()->get(Service::class)->setClient($client);
$this->runCommand('command', [], true);