Skip to content

Commit

Permalink
feature #29541 [FrameworkBundle] Stop calling Kernel::boot() twice in…
Browse files Browse the repository at this point in the history
… 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
-------

97e15fe [FrameworkBundle] Stop calling Kernel::boot() twice in cli
  • Loading branch information
fabpot committed Dec 10, 2018
2 parents b2cc270 + 97e15fe commit d069c26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Symfony/Bundle/FrameworkBundle/Console/Application.php
Expand Up @@ -62,16 +62,14 @@ public function getKernel()
*/
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);
}

Expand Down
Expand Up @@ -204,6 +204,7 @@ public function testRunOnlyWarnsOnUnregistrableCommandAtTheEnd()
$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(
Expand Down Expand Up @@ -256,6 +257,7 @@ private function getKernel(array $bundles, $useDispatcher = false)
;

$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
$kernel->expects($this->once())->method('boot');
$kernel
->expects($this->any())
->method('getBundles')
Expand Down

0 comments on commit d069c26

Please sign in to comment.