Skip to content

Commit 266df0e

Browse files
author
Robin Chalas
committed
Fix BC break in console.command.ids parameter
1 parent 0d93600 commit 266df0e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Console/Application.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,9 @@ protected function registerCommands()
173173
}
174174

175175
if ($container->hasParameter('console.command.ids')) {
176+
$lazyCommandIds = $container->hasParameter('console.lazy_command.ids') ? $container->getParameter('console.lazy_command.ids') : array();
176177
foreach ($container->getParameter('console.command.ids') as $id) {
177-
if (false !== $id) {
178+
if (!isset($lazyCommandIds[$id])) {
178179
try {
179180
$this->add($container->get($id));
180181
} catch (\Exception $e) {

Tests/Console/ApplicationTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,16 @@ private function getKernel(array $bundles, $useDispatcher = false)
183183
}
184184

185185
$container
186-
->expects($this->once())
186+
->expects($this->exactly(2))
187187
->method('hasParameter')
188-
->with($this->equalTo('console.command.ids'))
189-
->will($this->returnValue(true))
188+
->withConsecutive(array('console.command.ids'), array('console.lazy_command.ids'))
189+
->willReturnOnConsecutiveCalls(true, true)
190190
;
191191
$container
192-
->expects($this->once())
192+
->expects($this->exactly(2))
193193
->method('getParameter')
194-
->with($this->equalTo('console.command.ids'))
195-
->will($this->returnValue(array()))
194+
->withConsecutive(array('console.lazy_command.ids'), array('console.command.ids'))
195+
->willReturnOnConsecutiveCalls(array(), array())
196196
;
197197

198198
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();

0 commit comments

Comments
 (0)