Skip to content

Commit 1221c54

Browse files
committed
Merge branch '3.4' into 4.0
* 3.4: [Form][WCAG] Add hidden labels on date and time fields Pass on previous exception in FatalThrowableError [Routing] remove dead code [Routing] fix typo [Form][WCAG] Fixed HTML errors fix merge [FrameworkBundle] [Console] add a warning when command is not found [WebProfilerBundle] limit ajax request to 100 and remove the last one
2 parents cddab67 + d65ccfb commit 1221c54

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

Console/Application.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public function doRun(InputInterface $input, OutputInterface $output)
6565

6666
$this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));
6767

68+
$this->registerCommands();
69+
6870
if ($this->registrationErrors) {
6971
$this->renderRegistrationErrors($input, $output);
7072
}

Tests/Console/ApplicationTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,33 @@ public function testRunOnlyWarnsOnUnregistrableCommand()
165165
$this->assertContains('fine', $output);
166166
}
167167

168+
public function testRegistrationErrorsAreDisplayedOnCommandNotFound()
169+
{
170+
$container = new ContainerBuilder();
171+
$container->register('event_dispatcher', EventDispatcher::class);
172+
173+
$kernel = $this->getMockBuilder(KernelInterface::class)->getMock();
174+
$kernel
175+
->method('getBundles')
176+
->willReturn(array($this->createBundleMock(
177+
array((new Command(null))->setCode(function (InputInterface $input, OutputInterface $output) { $output->write('fine'); }))
178+
)));
179+
$kernel
180+
->method('getContainer')
181+
->willReturn($container);
182+
183+
$application = new Application($kernel);
184+
$application->setAutoExit(false);
185+
186+
$tester = new ApplicationTester($application);
187+
$tester->run(array('command' => 'fine'));
188+
$output = $tester->getDisplay();
189+
190+
$this->assertSame(1, $tester->getStatusCode());
191+
$this->assertContains('Some commands could not be registered:', $output);
192+
$this->assertContains('Command "fine" is not defined.', $output);
193+
}
194+
168195
private function getKernel(array $bundles, $useDispatcher = false)
169196
{
170197
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();

Tests/Routing/RouterTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,17 @@ public function testDefaultValuesAsNonStrings($value)
220220

221221
public function testGetRouteCollectionAddsContainerParametersResource()
222222
{
223-
$routeCollection = $this->getMockBuilder(RouteCollection::class)->getMock();
224-
$routeCollection->method('getIterator')->willReturn(new \ArrayIterator(array(new Route('/%locale%'))));
225-
$routeCollection->expects($this->once())->method('addResource')->with(new ContainerParametersResource(array('locale' => 'en')));
223+
$routeCollection = new RouteCollection();
224+
$routeCollection->add('foo', new Route('/%locale%'));
226225

227226
$sc = $this->getServiceContainer($routeCollection);
228227
$sc->setParameter('locale', 'en');
229228

230229
$router = new Router($sc, 'foo');
231230

232-
$router->getRouteCollection();
231+
$routeCollection = $router->getRouteCollection();
232+
233+
$this->assertEquals(array(new ContainerParametersResource(array('locale' => 'en'))), $routeCollection->getResources());
233234
}
234235

235236
public function getNonStringValues()

0 commit comments

Comments
 (0)