8000 Merge branch '3.0' · symfony/symfony@a1b2d8c · GitHub
[go: up one dir, main page]

Skip to content

Commit a1b2d8c

Browse files
committed
Merge branch '3.0'
* 3.0: Fix computation of PR diffs for component matrix lines [console][table] adjust width of colspanned cell. [BUG] Delete class 'control-group' in bootstrap 3 [2.8] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper added missing constant in Response Update HTTP statuses list [Console][#18619] Prevent fatal error when calling Command#getHelper() without helperSet added StaticVerionStrategyTest Add SplFileInfo array doc on Finder iterator methods so that IDE will know what it returns [2.3] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper Updated the link to the list of currency codes Fixed DateTimeInterface comparaison [console][table] adjust width of colspanned cell.
2 parents 219b050 + 797e83f commit a1b2d8c

File tree

23 files changed

+189
-105
lines changed

23 files changed

+189
-105
lines changed

< 6D40 code>‎.travis.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
<?php
22

33
if (4 > $_SERVER['argc']) {
4-
echo "Usage: commit-range branch dir1 dir2 ... dirN\n";
4+
echo "Usage: branch dir1 dir2 ... dirN\n";
55
exit(1);
66
}
77

88
$dirs = $_SERVER['argv'];
99
array_shift($dirs);
10-
$range = array_shift($dirs);
1110
$branch = array_shift($dirs);
1211

1312
$packages = array();
1413
$flags = PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
1514

1615
foreach ($dirs as $dir) {
17-
if (!`git diff --name-only $range -- $dir`) {
16+
if (!`git diff --name-only $branch...HEAD -- $dir`) {
1817
continue;
1918
}
2019
echo "$dir\n";

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ before_install:
6666
install:
6767
- if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
6868
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
69-
- if [[ ! $skip && $deps ]]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi
69+
- if [[ ! $skip && $deps ]]; then php .travis.php $TRAVIS_BRANCH $COMPONENTS; fi
7070
# For the master branch when deps=high, the version before master is checked out and tested with the locally patched components
7171
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi
7272
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); ./phpunit install; fi

F438 src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,12 @@
9494

9595
{% block choice_widget_expanded -%}
9696
{% if '-inline' in label_attr.class|default('') -%}
97-
<div class="control-group">
98-
{%- for child in form %}
99-
{{- form_widget(child, {
100-
parent_label_class: label_attr.class|default(''),
101-
translation_domain: choice_translation_domain,
102-
}) -}}
103-
{% endfor -%}
104-
</div>
97+
{%- for child in form %}
98+
{{- form_widget(child, {
99+
parent_label_class: label_attr.class|default(''),
100+
translation_domain: choice_translation_domain,
101+
}) -}}
102+
{% endfor -%}
105103
{%- else -%}
106104
<div {{ block('widget_container_attributes') }}>
107105
{%- for child in form %}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Asset\Tests\VersionStrategy;
13+
14+
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;
15+
16+
class StaticVersionStrategyTest extends \PHPUnit_Framework_TestCase
17+
{
18+
public function testGetVersion()
19+
{
20+
$version = 'v1';
21+
$path = 'test-path';
22+
$staticVersionStrategy = new StaticVersionStrategy($version);
23+
$this->assertEquals($version, $staticVersionStrategy->getVersion($path));
24+
}
25+
26+
/**
27+
* @dataProvider getConfigs
28+
*/
29+
public function testApplyVersion($path, $version, $format)
30+
{
31+
$staticVersionStrategy = new StaticVersionStrategy($version, $format);
32+
$formatted = sprintf($format ?: '%s?%s', $path, $version);
33+
$this->assertEquals($formatted, $staticVersionStrategy->applyVersion($path));
34+
}
35+
36+
public function getConfigs()
37+
{
38+
return array(
39+
array('test-path', 'v1', null),
40+
array('test-path', 'v2', '%s?test%s'),
41+
);
42+
}
43+
}

src/Symfony/Component/Console/Command/Command.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,15 @@ public function getUsages()
601601
*
602602
* @return mixed The helper value
603603
*
604+
* @throws LogicException if no HelperSet is defined
604605
* @throws InvalidArgumentException if the helper is not defined
605606
*/
606607
public function getHelper($name)
607608
{
609+
if (null === $this->helperSet) {
610+
throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
611+
}
612+
608613
return $this->helperSet->get($name);
609614
}
610615

src/Symfony/Component/Console/Helper/Table.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,18 @@ private function calculateColumnsWidth($rows)
608608
continue;
609609
}
610610

611+
foreach ($row as $i => $cell) {
612+
if ($cell instanceof TableCell) {
613+
$textLength = strlen($cell);
614+
if ($textLength > 0) {
615+
$contentColumns = str_split($cell, ceil($textLength / $cell->getColspan()));
616+
foreach ($contentColumns as $position => $content) {
617+
$row[$i + $position] = $content;
618+
}
619+
}
620+
}
621+
}
622+
611623
$lengths[] = $this->getCellWidth($row, $column);
612624
}
613625

@@ -640,10 +652,6 @@ private function getCellWidth(array $row, $column)
640652
if (isset($row[$column])) {
641653
$cell = $row[$column];
642654
$cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
643-
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
644-
// we assume that cell value will be across more than one column.
645-
$cellWidth = $cellWidth / $cell->getColspan();
646-
}
647655
}
648656

649657
$columnWidth = isset($this->columnWidths[$column]) ? $this->columnWidths[$column] : 0;

src/Symfony/Component/Console/Tests/Command/CommandTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,16 @@ public function testGetHelper()
173173
$this->assertEquals($formatterHelper->getName(), $command->getHelper('formatter')->getName(), '->getHelper() returns the correct helper');
174174
}
175175

176+
/**
177+
* @expectedException \LogicException
178+
* @expectedExceptionMessage Cannot retrieve helper "formatter" because there is no HelperSet defined.
179+
*/
180+
public function testGetHelperWithoutHelperSet()
181+
{
182+
$command = new \TestCommand();
183+
$command->getHelper('formatter');
184+
}
185+
176186
public function testMergeApplicationDefinition()
177187
{
178188
$application1 = new Application();

src/Symfony/Component/Console/Tests/Helper/TableTest.php

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -269,21 +269,27 @@ public function testRenderProvider()
269269
'9971-5-0210-0',
270270
new TableCell("A Tale of \nTwo Cities", array('colspan' => 2)),
271271
),
272+
new TableSeparator(),
273+
array(
274+
new TableCell('Cupiditate dicta atque porro, tempora exercitationem modi animi nulla nemo vel nihil!', array('colspan' => 3)),
275+
),
272276
),
273277
'default',
274278
<<<TABLE
275-
+----------------+---------------+-----------------+
276-
| ISBN | Title | Author |
277-
+----------------+---------------+-----------------+
278-
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
279-
+----------------+---------------+-----------------+
280-
| Divine Comedy(Dante Alighieri) |
281-
+----------------+---------------+-----------------+
282-
| Arduino: A Quick-Start Guide | Mark Schmidt |
283-
+----------------+---------------+-----------------+
284-
| 9971-5-0210-0 | A Tale of |
285-
| | Two Cities |
286-
+----------------+---------------+-----------------+
279+
+-------------------------------+-------------------------------+-----------------------------+
280+
| ISBN | Title | Author |
281+
+-------------------------------+-------------------------------+-----------------------------+
282+
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
283+
+-------------------------------+-------------------------------+-----------------------------+
284+
| Divine Comedy(Dante Alighieri) |
285+
+-------------------------------+-------------------------------+-----------------------------+
286+
| Arduino: A Quick-Start Guide | Mark Schmidt |
287+
+-------------------------------+-------------------------------+-----------------------------+
288+
| 9971-5-0210-0 | A Tale of |
289+
| | Two Cities |
290+
+-------------------------------+-------------------------------+-----------------------------+
291+
| Cupiditate dicta atque porro, tempora exercitationem modi animi nulla nemo vel nihil! |
292+
+-------------------------------+-------------------------------+-----------------------------+
287293
288294
TABLE
289295
),
@@ -336,16 +342,16 @@ public function testRenderProvider()
336342
),
337343
'default',
338344
<<<TABLE
339-
+------------------+--------+-----------------+
340-
| ISBN | Title | Author |
341-
+------------------+--------+-----------------+
342-
| 9971-5-0210-0 | Dante Alighieri |
343-
| | Charles Dickens |
344-
+------------------+--------+-----------------+
345-
| Dante Alighieri | 9971-5-0210-0 |
346-
| J. R. R. Tolkien | |
347-
| J. R. R | |
348-
+------------------+--------+-----------------+
345+
+------------------+---------+-----------------+
346+
| ISBN | Title | Author |
347+
+------------------+---------+-----------------+
348+
| 9971-5-0210-0 | Dante Alighieri |
349+
| | Charles Dickens |
350+
+------------------+---------+-----------------+
351+
| Dante Alighieri | 9971-5-0210-0 |
352+
| J. R. R. Tolkien | |
353+
| J. R. R | |
354+
+------------------+---------+-----------------+
349355
350356
TABLE
351357
),
@@ -473,9 +479,9 @@ public function testRenderProvider()
473479
),
474480
'default',
475481
<<<TABLE
476-
+--+--+--+--+--+--+--+--+--+
477-
| 1 | 2 | 3 | 4 |
478-
+--+--+--+--+--+--+--+--+--+
482+
+---+--+--+---+--+---+--+---+--+
483+
| 1 | 2 | 3 | 4 |
484+
+---+--+--+---+--+---+--+---+--+
479485
480486
TABLE
481487
),
@@ -580,15 +586,15 @@ public function testRenderMultiCalls()
580586

581587
$expected =
582588
<<<TABLE
583-
+---+--+
584-
| foo |
585-
+---+--+
586-
+---+--+
587-
| foo |
588-
+---+--+
589-
+---+--+
590-
| foo |
591-
+---+--+
589+
+----+---+
590+
| foo |
591+
+----+---+
592+
+----+---+
593+
| foo |
594+
+----+---+
595+
+----+---+
596+
| foo |
597+
+----+---+
592598
593599
TABLE;
594600

0 commit comments

Comments
 (0)
0