Skip to content

Commit d069c26

Browse files
committed
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 ------- 97e15fe [FrameworkBundle] Stop calling Kernel::boot() twice in cli
2 parents b2cc270 + 97e15fe commit d069c26

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Symfony/Bundle/FrameworkBundle/Console/Application.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,14 @@ public function getKernel()
6262
*/
6363
public function doRun(InputInterface $input, OutputInterface $output)
6464
{
65-
$this->kernel->boot();
66-
67-
$this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));
68-
6965
$this->registerCommands();
7066

7167
if ($this->registrationErrors) {
7268
$this->renderRegistrationErrors($input, $output);
7369
}
7470

71+
$this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));
72+
7573
return parent::doRun($input, $output);
7674
}
7775

src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ public function testRunOnlyWarnsOnUnregistrableCommandAtTheEnd()
204204
$container->setParameter('console.command.ids', array(ThrowingCommand::class => ThrowingCommand::class));
205205

206206
$kernel = $this->getMockBuilder(KernelInterface::class)->getMock();
207+
$kernel->expects($this->once())->method('boot');
207208
$kernel
208209
->method('getBundles')
209210
->willReturn(array($this->createBundleMock(
@@ -256,6 +257,7 @@ private function getKernel(array $bundles, $useDispatcher = false)
256257
;
257258

258259
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
260+
$kernel->expects($this->once())->method('boot');
259261
$kernel
260262
->expects($this->any())
261263
->method('getBundles')

0 commit comments

Comments
 (0)