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:
commit
d069c264b3
@ -62,16 +62,14 @@ class Application extends BaseApplication
|
|||||||
*/
|
*/
|
||||||
public function doRun(InputInterface $input, OutputInterface $output)
|
public function doRun(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$this->kernel->boot();
|
|
||||||
|
|
||||||
$this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));
|
|
||||||
|
|
||||||
$this->registerCommands();
|
$this->registerCommands();
|
||||||
|
|
||||||
if ($this->registrationErrors) {
|
if ($this->registrationErrors) {
|
||||||
$this->renderRegistrationErrors($input, $output);
|
$this->renderRegistrationErrors($input, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));
|
||||||
|
|
||||||
return parent::doRun($input, $output);
|
return parent::doRun($input, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,6 +204,7 @@ class ApplicationTest extends TestCase
|
|||||||
$container->setParameter('console.command.ids', array(ThrowingCommand::class => ThrowingCommand::class));
|
$container->setParameter('console.command.ids', array(ThrowingCommand::class => ThrowingCommand::class));
|
||||||
|
|
||||||
$kernel = $this->getMockBuilder(KernelInterface::class)->getMock();
|
$kernel = $this->getMockBuilder(KernelInterface::class)->getMock();
|
||||||
|
$kernel->expects($this->once())->method('boot');
|
||||||
$kernel
|
$kernel
|
||||||
->method('getBundles')
|
->method('getBundles')
|
||||||
->willReturn(array($this->createBundleMock(
|
->willReturn(array($this->createBundleMock(
|
||||||
@ -256,6 +257,7 @@ class ApplicationTest extends TestCase
|
|||||||
;
|
;
|
||||||
|
|
||||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
||||||
|
$kernel->expects($this->once())->method('boot');
|
||||||
$kernel
|
$kernel
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getBundles')
|
->method('getBundles')
|
||||||
|
Reference in New Issue
Block a user