10000 Merge branch '4.0' · symfony/symfony@97cee3a · GitHub
[go: up one dir, main page]

Skip to content

Commit 97cee3a

Browse files
committed
Merge branch '4.0'
* 4.0: [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 1928faf + 96aac17 commit 97cee3a

File tree

10 files changed

+68
-9
lines changed

10 files changed

+68
-9
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@
103103
{% if type is not defined or type != 'hidden' %}
104104
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control' ~ (type|default('') == 'file' ? '-file' : ''))|trim}) -%}
105105
{% endif %}
106+
{%- if type is defined and (type == 'range' or type == 'color') %}
107+
{# Attribute "required" is not supported #}
108+
{%- set required = false -%}
109+
{% endif %}
106110
{{- parent() -}}
107111
{%- endblock form_widget_simple %}
108112

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_base_layout.html.twig

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@
4040
<div {{ block('widget_container_attributes') }}>
4141
{{- form_errors(form.date) -}}
4242
{{- form_errors(form.time) -}}
43+
44+
<div class="sr-only">
45+
{%- if form.date.year is defined %}{{ form_label(form.date.year) }}{% endif -%}
46+
{%- if form.date.month is defined %}{{ form_label(form.date.month) }}{% endif -%}
47+
{%- if form.date.day is defined %}{{ form_label(form.date.day) }}{% endif -%}
48+
{%- if form.time.hour is defined %}{{ form_label(form.time.hour) }}{% endif -%}
49+
{%- if form.time.minute is defined %}{{ form_label(form.time.minute) }}{% endif -%}
50+
{%- if form.time.second is defined %}{{ form_label(form.time.second) }}{% endif -%}
51+
</div>
52+
4353
{{- form_widget(form.date, { datetime: true } ) -}}
4454
{{- form_widget(form.time, { datetime: true } ) -}}
4555
</div>
@@ -54,6 +64,12 @@
5464
{%- if datetime is not defined or not datetime -%}
5565
<div {{ block('widget_container_attributes') -}}>
5666
{%- endif %}
67+
<div class="sr-only">
68+
{{ form_label(form.year) }}
69+
{{ form_label(form.month) }}
70+
{{ form_label(form.day) }}
71+
</div>
72+
5773
{{- date_pattern|replace({
5874
'{{ year }}': form_widget(form.year),
5975
'{{ month }}': form_widget(form.month),
@@ -73,7 +89,10 @@
7389
{%- if datetime is not defined or false == datetime -%}
7490
<div {{ block('widget_container_attributes') -}}>
7591
{%- endif -%}
76-
{{- form_widget(form.hour) }}{% if with_minutes %}:{{ form_widget(form.minute) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second) }}{% endif %}
92+
<div class="sr-only">{{ form_label(form.hour) }}</div>
93+
{{- form_widget(form.hour) -}}
94+
{%- if with_minutes -%}:<div class="sr-only">{{ form_label(form.minute) }}</div>{{ form_widget(form.minute) }}{%- endif -%}
95+
{%- if with_seconds -%}:<div class="sr-only">{{ form_label(form.second) }}</div>{{ form_widget(form.second) }}{%- endif -%}
7796
{%- if datetime is not defined or false == datetime -%}
7897
</div>
7998
{%- endif -%}

src/Symfony/Bundle/FrameworkBundle/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
}

src/Symfony/Bundle/FrameworkBundle/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();

src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,8 @@ public function testDefaultValuesAsNonStringsWithSfContainer($value)
421421

422422
public function testGetRouteCollectionAddsContainerParametersResource()
423423
{
424-
$routeCollection = $this->getMockBuilder(RouteCollection::class)->getMock();
425-
$routeCollection->method('getIterator')->willReturn(new \ArrayIterator(array(new Route('/%locale%'))));
426-
$routeCollection->expects($this->once())->method('addResource')->with(new ContainerParametersResource(array('locale' => 'en')));
424+
$routeCollection = new RouteCollection();
425+
$routeCollection->add('foo', new Route('/%locale%'));
427426

428427
$sc = $this->getPsr11ServiceContainer($routeCollection);
429428
$parameters = $this->getParameterBag(array('locale' => 'en'));
@@ -444,7 +443,9 @@ public function testGetRouteCollectionAddsContainerParametersResourceWithSfConta
444443

445444
$router = new Router($sc, 'foo');
446445

447-
$router->getRouteCollection();
446+
$routeCollection = $router->getRouteCollection();
447+
448+
$this->assertEquals(array(new ContainerParametersResource(array('locale' => 'en'))), $routeCollection->getResources());
448449
}
449450

450451
public function getNonStringValues()

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@
122122
return;
123123
}
124124
125+
var nbOfAjaxRequest = tbody.rows.count();
126+
if (nbOfAjaxRequest >= 100) {
127+
tbody.deleteRow(nbOfAjaxRequest - 1);
128+
}
129+
125130
var request = requestStack[index];
126131
pendingRequests++;
127132
var row = document.createElement('tr');

src/Symfony/Component/Debug/Exception/FatalThrowableError.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public function __construct(\Throwable $e)
3737
$e->getCode(),
3838
$severity,
3939
$e->getFile(),
40-
$e->getLine()
40+
$e->getLine(),
41+
$e->getPrevious()
4142
);
4243

4344
$this->setTrace($e->getTrace());

src/Symfony/Component/Routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected function getUrlMatcher(RouteCollection $routes, RequestContext $contex
2525

2626
$class = 'DumpedRedirectableUrlMatcher'.++$i;
2727
$dumper = new PhpMatcherDumper($routes);
28-
$dumpedRoutes = eval('?>'.$dumper->dump(array('class' => $class, 'base_class' => 'Symfony\Component\Routing\Tests\Matcher\TestDumpedRedirectableUrlMatcher')));
28+
eval('?>'.$dumper->dump(array('class' => $class, 'base_class' => 'Symfony\Component\Routing\Tests\Matcher\TestDumpedRedirectableUrlMatcher')));
2929

3030
return $this->getMockBuilder($class)
3131
->setConstructorArgs(array($context ?: new RequestContext()))

src/Symfony/Component/Routing/Tests/Matcher/DumpedUrlMatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function getUrlMatcher(RouteCollection $routes, RequestContext $contex
2323

2424
$class = 'DumpedUrlMatcher'.++$i;
2525
$dumper = new PhpMatcherDumper($routes);
26-
$dumpedRoutes = eval('?>'.$dumper->dump(array('class' => $class)));
26+
eval('?>'.$dumper->dump(array('class' => $class)));
2727

2828
return new $class($context ?: new RequestContext());
2929
}

src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function testSchemeRedirectRedirectsToFirstScheme()
6666
$matcher->match('/foo');
6767
}
6868

69-
public function testNoSchemaRedirectIfOnOfMultipleSchemesMatches()
69+
public function testNoSchemaRedirectIfOneOfMultipleSchemesMatches()
7070
{
7171
$coll = new RouteCollection();
7272
$coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https', 'http')));

0 commit comments

Comments
 (0)
0