feature #29541 [FrameworkBundle] Stop calling Kernel::boot() twice in cli (chalasr)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[FrameworkBundle] Stop calling Kernel::boot() twice in cli

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #29505
| License       | MIT
| Doc PR        | n/a

Allows custom `Kernel::boot()` implementations to not be aware of the protected `Kernel::$booted` prop.

Commits
-------

97e15fe1b5 [FrameworkBundle] Stop calling Kernel::boot() twice in cli
This commit is contained in:
Fabien Potencier 2018-12-10 05:26:30 +01:00
commit d069c264b3
2 changed files with 4 additions and 4 deletions

View File

@ -62,16 +62,14 @@ class Application extends BaseApplication
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
$this->kernel->boot();
$this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));
$this->registerCommands();
if ($this->registrationErrors) {
$this->renderRegistrationErrors($input, $output);
}
$this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));
return parent::doRun($input, $output);
}

View File

@ -204,6 +204,7 @@ class ApplicationTest extends TestCase
$container->setParameter('console.command.ids', array(ThrowingCommand::class => ThrowingCommand::class));
$kernel = $this->getMockBuilder(KernelInterface::class)->getMock();
$kernel->expects($this->once())->method('boot');
$kernel
->method('getBundles')
->willReturn(array($this->createBundleMock(
@ -256,6 +257,7 @@ class ApplicationTest extends TestCase
;
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
$kernel->expects($this->once())->method('boot');
$kernel
->expects($this->any())
->method('getBundles')