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
This commit is contained in:
Fabien Potencier 2018-02-28 13:50:02 -08:00
commit 96aac17c0d
10 changed files with 69 additions and 10 deletions

View File

@ -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 %}

View File

@ -40,6 +40,16 @@
<div {{ block('widget_container_attributes') }}>
{{- form_errors(form.date) -}}
{{- form_errors(form.time) -}}
<div class="sr-only">
{%- 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 -%}
</div>
{{- form_widget(form.date, { datetime: true } ) -}}
{{- form_widget(form.time, { datetime: true } ) -}}
</div>
@ -54,6 +64,12 @@
{%- if datetime is not defined or not datetime -%}
<div {{ block('widget_container_attributes') -}}>
{%- endif %}
<div class="sr-only">
{{ form_label(form.year) }}
{{ form_label(form.month) }}
{{ form_label(form.day) }}
</div>
{{- 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 -%}
<div {{ block('widget_container_attributes') -}}>
{%- endif -%}
{{- form_widget(form.hour) }}{% if with_minutes %}:{{ form_widget(form.minute) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second) }}{% endif %}
<div class="sr-only">{{ form_label(form.hour) }}</div>
{{- form_widget(form.hour) -}}
{%- if with_minutes -%}:<div class="sr-only">{{ form_label(form.minute) }}</div>{{ form_widget(form.minute) }}{%- endif -%}
{%- if with_seconds -%}:<div class="sr-only">{{ form_label(form.second) }}</div>{{ form_widget(form.second) }}{%- endif -%}
{%- if datetime is not defined or false == datetime -%}
</div>
{%- endif -%}

View File

@ -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);
}

View File

@ -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();

View File

@ -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()

View File

@ -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');

View File

@ -36,7 +36,8 @@ class FatalThrowableError extends FatalErrorException
$e->getCode(),
$severity,
$e->getFile(),
$e->getLine()
$e->getLine(),
$e->getPrevious()
);
$this->setTrace($e->getTrace());

View File

@ -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()))

View File

@ -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());
}

View File

@ -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')));