8000 Merge branch '3.4' into 4.0 · symfony/symfony@96aac17 · GitHub
[go: up one dir, main page]

Skip to content

Commit 96aac17

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 6c32bcd + b7b6bd2 commit 96aac17

File tree

10 files changed

+69
-10
lines changed

10 files changed

+69
-10
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
@@ -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()

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
@@ -36,7 +36,8 @@ public function __construct(\Throwable $e)
3636
$e->getCode(),
3737
$severity,
3838
$e->getFile(),
39-
$e->getLine()
39+
$e->getLine(),
40+
$e->getPrevious()
4041
);
4142

4243
$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
@@ -41,7 +41,7 @@ protected function getUrlMatcher(RouteCollection $routes, RequestContext $contex
4141

4242
$class = 'DumpedUrlMatcher'.++$i;
4343
$dumper = new PhpMatcherDumper($routes);
44-
$dumpedRoutes = eval('?>'.$dumper->dump(array('class' => $class)));
44+
eval('?>'.$dumper->dump(array('class' => $class)));
4545

4646
return new $class($context ?: new RequestContext());
4747
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class RedirectableUrlMatcherTest extends UrlMatcherTest
1919
{
20-
public function testRedirectWhenNoSlash()
20+
public function testMissingTrailingSlash()
2121
{
2222
$coll = new RouteCollection();
2323
$coll->add('foo', new Route('/foo/'));
@@ -56,7 +56,7 @@ public function testSchemeRedirectRedirectsToFirstScheme()
5656
$matcher->match('/foo');
5757
}
5858

59-
public function testNoSchemaRedirectIfOnOfMultipleSchemesMatches()
59+
public function testNoSchemaRedirectIfOneOfMultipleSchemesMatches()
6060
{
6161
$coll = new RouteCollection();
6262
$coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https', 'http')));

0 commit comments

Comments
 (0)
0