diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig index a1e986a39a..92a857ec82 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig @@ -103,6 +103,10 @@ {% if type is not defined or type != 'hidden' %} {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control' ~ (type|default('') == 'file' ? '-file' : ''))|trim}) -%} {% endif %} + {%- if type is defined and (type == 'range' or type == 'color') %} + {# Attribute "required" is not supported #} + {%- set required = false -%} + {% endif %} {{- parent() -}} {%- endblock form_widget_simple %} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_base_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_base_layout.html.twig index 71aedf99ad..4ad6539141 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_base_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_base_layout.html.twig @@ -40,6 +40,16 @@
{{- form_errors(form.date) -}} {{- form_errors(form.time) -}} + +
+ {%- if form.date.year is defined %}{{ form_label(form.date.year) }}{% endif -%} + {%- if form.date.month is defined %}{{ form_label(form.date.month) }}{% endif -%} + {%- if form.date.day is defined %}{{ form_label(form.date.day) }}{% endif -%} + {%- if form.time.hour is defined %}{{ form_label(form.time.hour) }}{% endif -%} + {%- if form.time.minute is defined %}{{ form_label(form.time.minute) }}{% endif -%} + {%- if form.time.second is defined %}{{ form_label(form.time.second) }}{% endif -%} +
+ {{- form_widget(form.date, { datetime: true } ) -}} {{- form_widget(form.time, { datetime: true } ) -}}
@@ -54,6 +64,12 @@ {%- if datetime is not defined or not datetime -%}
{%- endif %} +
+ {{ form_label(form.year) }} + {{ form_label(form.month) }} + {{ form_label(form.day) }} +
+ {{- date_pattern|replace({ '{{ year }}': form_widget(form.year), '{{ month }}': form_widget(form.month), @@ -73,7 +89,10 @@ {%- if datetime is not defined or false == datetime -%}
{%- endif -%} - {{- form_widget(form.hour) }}{% if with_minutes %}:{{ form_widget(form.minute) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second) }}{% endif %} +
{{ form_label(form.hour) }}
+ {{- form_widget(form.hour) -}} + {%- if with_minutes -%}:
{{ form_label(form.minute) }}
{{ form_widget(form.minute) }}{%- endif -%} + {%- if with_seconds -%}:
{{ form_label(form.second) }}
{{ form_widget(form.second) }}{%- endif -%} {%- if datetime is not defined or false == datetime -%}
{%- endif -%} diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index bcdec7eee3..2be849db17 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -65,6 +65,8 @@ class Application extends BaseApplication $this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher')); + $this->registerCommands(); + if ($this->registrationErrors) { $this->renderRegistrationErrors($input, $output); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php index d06e98be77..c977bb13a1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php @@ -165,6 +165,33 @@ class ApplicationTest extends TestCase $this->assertContains('fine', $output); } + public function testRegistrationErrorsAreDisplayedOnCommandNotFound() + { + $container = new ContainerBuilder(); + $container->register('event_dispatcher', EventDispatcher::class); + + $kernel = $this->getMockBuilder(KernelInterface::class)->getMock(); + $kernel + ->method('getBundles') + ->willReturn(array($this->createBundleMock( + array((new Command(null))->setCode(function (InputInterface $input, OutputInterface $output) { $output->write('fine'); })) + ))); + $kernel + ->method('getContainer') + ->willReturn($container); + + $application = new Application($kernel); + $application->setAutoExit(false); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'fine')); + $output = $tester->getDisplay(); + + $this->assertSame(1, $tester->getStatusCode()); + $this->assertContains('Some commands could not be registered:', $output); + $this->assertContains('Command "fine" is not defined.', $output); + } + private function getKernel(array $bundles, $useDispatcher = false) { $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php index e0548078fc..ba5db79405 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php @@ -220,16 +220,17 @@ class RouterTest extends TestCase public function testGetRouteCollectionAddsContainerParametersResource() { - $routeCollection = $this->getMockBuilder(RouteCollection::class)->getMock(); - $routeCollection->method('getIterator')->willReturn(new \ArrayIterator(array(new Route('/%locale%')))); - $routeCollection->expects($this->once())->method('addResource')->with(new ContainerParametersResource(array('locale' => 'en'))); + $routeCollection = new RouteCollection(); + $routeCollection->add('foo', new Route('/%locale%')); $sc = $this->getServiceContainer($routeCollection); $sc->setParameter('locale', 'en'); $router = new Router($sc, 'foo'); - $router->getRouteCollection(); + $routeCollection = $router->getRouteCollection(); + + $this->assertEquals(array(new ContainerParametersResource(array('locale' => 'en'))), $routeCollection->getResources()); } public function getNonStringValues() diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig index 5c2be8c74c..a59e7811d6 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig @@ -122,6 +122,11 @@ return; } + var nbOfAjaxRequest = tbody.rows.count(); + if (nbOfAjaxRequest >= 100) { + tbody.deleteRow(nbOfAjaxRequest - 1); + } + var request = requestStack[index]; pendingRequests++; var row = document.createElement('tr'); diff --git a/src/Symfony/Component/Debug/Exception/FatalThrowableError.php b/src/Symfony/Component/Debug/Exception/FatalThrowableError.php index 34f43b17b1..fafc92263e 100644 --- a/src/Symfony/Component/Debug/Exception/FatalThrowableError.php +++ b/src/Symfony/Component/Debug/Exception/FatalThrowableError.php @@ -36,7 +36,8 @@ class FatalThrowableError extends FatalErrorException $e->getCode(), $severity, $e->getFile(), - $e->getLine() + $e->getLine(), + $e->getPrevious() ); $this->setTrace($e->getTrace()); diff --git a/src/Symfony/Component/Routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php index 28f65aeeb5..cfbb524d3a 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php @@ -25,7 +25,7 @@ class DumpedRedirectableUrlMatcherTest extends RedirectableUrlMatcherTest $class = 'DumpedRedirectableUrlMatcher'.++$i; $dumper = new PhpMatcherDumper($routes); - $dumpedRoutes = eval('?>'.$dumper->dump(array('class' => $class, 'base_class' => 'Symfony\Component\Routing\Tests\Matcher\TestDumpedRedirectableUrlMatcher'))); + eval('?>'.$dumper->dump(array('class' => $class, 'base_class' => 'Symfony\Component\Routing\Tests\Matcher\TestDumpedRedirectableUrlMatcher'))); return $this->getMockBuilder($class) ->setConstructorArgs(array($context ?: new RequestContext())) diff --git a/src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php index e36a0220d9..880b2b13b1 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php @@ -41,7 +41,7 @@ class DumpedUrlMatcherTest extends UrlMatcherTest $class = 'DumpedUrlMatcher'.++$i; $dumper = new PhpMatcherDumper($routes); - $dumpedRoutes = eval('?>'.$dumper->dump(array('class' => $class))); + eval('?>'.$dumper->dump(array('class' => $class))); return new $class($context ?: new RequestContext()); } diff --git a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php index 5f226271bf..7984391e12 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php @@ -17,7 +17,7 @@ use Symfony\Component\Routing\RequestContext; class RedirectableUrlMatcherTest extends UrlMatcherTest { - public function testRedirectWhenNoSlash() + public function testMissingTrailingSlash() { $coll = new RouteCollection(); $coll->add('foo', new Route('/foo/')); @@ -56,7 +56,7 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest $matcher->match('/foo'); } - public function testNoSchemaRedirectIfOnOfMultipleSchemesMatches() + public function testNoSchemaRedirectIfOneOfMultipleSchemesMatches() { $coll = new RouteCollection(); $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https', 'http')));