8000 Merge branch '2.8' · symfony/symfony@797b93b · GitHub
[go: up one dir, main page]

Skip to content

Commit 797b93b

Browse files
committed
Merge branch '2.8'
* 2.8: Remove profiler storages deprecate finding deep items in request parameters [CssSelector] updated README [CssSelector] remove ConverterInterface [DependencyInjection] improved a comment for reading fluency [HttpKernel] change a class in tests to avoid depending on SQLite [FrameworkBundle] Fix tests [Bridge\Twig] Fix form lowest version [ci] Display fastest results first when running tests in parallel [Yaml] Improve newline handling in folded scalar blocks
2 parents 232035e + bb4a511 commit 797b93b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+454
-201
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ install:
4747
- if [ "$deps" = "2.8" ]; then git fetch origin 2.8; git checkout -m FETCH_HEAD; export COMPOSER_ROOT_VERSION=2.8.x-dev; fi;
4848

4949
script:
50-
- if [ "$deps" = "no" ]; then echo "$COMPONENTS" | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; $PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
50+
- if [ "$deps" = "no" ]; then echo "$COMPONENTS" | parallel --gnu 'echo -e "\\nRunning {} tests"; $PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
5151
- if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi;
52-
- if [ "$deps" = "high" ]; then echo "$COMPONENTS" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
53-
- if [ "$deps" = "low" ]; then echo "$COMPONENTS" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
54-
- if [ "$deps" = "2.8" ]; then echo "$COMPONENTS" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data,legacy'; fi;
52+
- if [ "$deps" = "high" ]; then echo "$COMPONENTS" | parallel --gnu -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
53+
- if [ "$deps" = "low" ]; then echo "$COMPONENTS" | parallel --gnu -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
54+
- if [ "$deps" = "2.8" ]; then echo "$COMPONENTS" | parallel --gnu -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data,legacy'; fi;

phpunit

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ $exit = 0;
3333
if (isset($argv[1]) && 'symfony' === $argv[1]) {
3434
// Find Symfony components in plain php for Windows portability
3535

36-
$finder = new RecursiveDirectoryIterator('src/Symfony', FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::UNIX_PATHS);
36+
$finder = new RecursiveDirectoryIterator(__DIR__.'/src/Symfony', FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::UNIX_PATHS);
3737
$finder = new RecursiveIteratorIterator($finder);
3838
$finder->setMaxDepth(3);
3939

4040
array_shift($cmd);
4141
$cmd[0] = "php $PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit --colors=always";
42-
$procs = array();
42+
$runningProcs = array();
4343

4444
foreach ($finder as $file => $fileInfo) {
4545
if ('phpunit.xml.dist' === $file) {
@@ -50,7 +50,7 @@ if (isset($argv[1]) && 'symfony' === $argv[1]) {
5050
$c = escapeshellarg($component);
5151

5252
if ($proc = proc_open(implode(' ', $cmd)." $c > $c/phpunit.stdout 2> $c/phpunit.stderr", array(), $pipes)) {
53-
$procs[$component] = $proc;
53+
$runningProcs[$component] = $proc;
5454
} else {
5555
$exit = 1;
5656
echo "\033[41mKO\033[0m $component\n\n";
@@ -59,44 +59,54 @@ if (isset($argv[1]) && 'symfony' === $argv[1]) {
5959
}
6060

6161
// Fixes for colors support on appveyor
62-
// See http://help.appveyor.com/discussions/suggestions/197-support-ansi-color-codes
62+
// See https://github.com/appveyor/ci/issues/373
6363
$colorFixes = array(
6464
array("S\033[0m\033[0m\033[36m\033[1mS", "E\033[0m\033[0m\033[31m\033[1mE", "I\033[0m\033[0m\033[33m\033[1mI", "F\033[0m\033[0m\033[41m\033[37mF"),
6565
array("SS", "EE", "II", "FF"),
6666
);
6767
$colorFixes[0] = array_merge($colorFixes[0], $colorFixes[0]);
6868
$colorFixes[1] = array_merge($colorFixes[1], $colorFixes[1]);
6969

70-
foreach ($procs as $component => $proc) {
71-
$procStatus = proc_close($proc);
72-
73-
foreach (array('out', 'err') as $file) {
74-
$file = "$component/phpunit.std$file";
70+
while ($runningProcs) {
71+
usleep(300000);
72+
$terminatedProcs = array();
73+
foreach ($runningProcs as $component => $proc) {
74+
$procStatus = proc_get_status($proc);
75+
if (!$procStatus['running']) {
76+
$terminatedProcs[$component] = $procStatus['exitcode'];
77+
unset($runningProcs[$component]);
78+
proc_close($proc);
79+
}
80+
}
7581

76-
if ('\\' === DIRECTORY_SEPARATOR) {
77-
$h = fopen($file, 'rb');
78-
while (false !== $line = fgets($h)) {
79-
echo str_replace($colorFixes[0], $colorFixes[1], preg_replace(
80-
'/(\033\[[0-9]++);([0-9]++m)(?:(.)(\033\[0m))?/',
81-
"$1m\033[$2$3$4$4",
82-
$line
83-
));
82+
foreach ($terminatedProcs as $component => $procStatus) {
83+
foreach (array('out', 'err') as $file) {
84+
$file = "$component/phpunit.std$file";
85+
86+
if ('\\' === DIRECTORY_SEPARATOR) {
87+
$h = fopen($file, 'rb');
88+
while (false !== $line = fgets($h)) {
89+
echo str_replace($colorFixes[0], $colorFixes[1], preg_replace(
90+
'/(\033\[[0-9]++);([0-9]++m)(?:(.)(\033\[0m))?/',
91+
"$1m\033[$2$3$4$4",
92+
$line
93+
));
94+
}
95+
fclose($h);
96+
} else {
97+
readfile($file);
8498
}
85-
fclose($h);
86-
} else {
87-
readfile($file);
99+
unlink($file);
88100
}
89-
unlink($file);
90-
}
91101

92-
if ($procStatus) {
93-
$exit = 1;
94-
echo "\033[41mKO\033[0m $component\n\n";
95-
} else {
96-
echo "\033[32mOK\033[0m $component\n\n";
102+
if ($procStatus) {
103+
$exit = 1;
104+
echo "\033[41mKO\033[0m $component\n\n";
105+
} else {
106+
echo "\033[32mOK\033[0m $component\n\n";
107+
}
97108
}
98109
}
99-
100110
} elseif (!isset($argv[1]) || 'install' !== $argv[1]) {
101111
// Run regular phpunit in a subprocess
102112

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected function describeRoute(Route $route, array $options = array())
7979
{
8080
$tableHeaders = array('Property', 'Value');
8181
$tableRows = array(
82-
array('Route Name', $options['name']),
82+
array('Route Name', isset($options['name']) ? $options['name'] : ''),
8383
array('Path', $route->getPath()),
8484
array('Path Regex', $route->compile()->getRegex()),
8585
array('Host', ('' !== $route->getHost() ? $route->getHost() : 'ANY')),

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,39 @@ private function addProfilerSection(ArrayNodeDefinition $rootNode)
173173
->booleanNode('collect')->defaultTrue()->end()
174174
->booleanNode('only_exceptions')->defaultFalse()->end()
175175
->booleanNode('only_master_requests')->defaultFalse()->end()
176-
->scalarNode('dsn')->defaultValue('file:%kernel.cache_dir%/profiler')->end()
177-
->scalarNode('username')->defaultValue('')->end()
178-
->scalarNode('password')->defaultValue('')->end()
176+
->scalarNode('dsn')
177+
->defaultValue('file:%kernel.cache_dir%/profiler')
178+
->beforeNormalization()
179+
->ifTrue(function ($v) { return 'file:' !== substr($v, 0, 5); })
180+
->then(function ($v) {
181+
@trigger_error('The profiler.dsn configuration key must start with "file:" because all the storages except the filesystem are deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
182+
183+
return $v;
184+
})
185+
->end()
186+
->end()
187+
->scalarNode('username')
188+
->defaultValue('')
189+
->beforeNormalization()
190+
->always()
191+
->then(function ($v) {
192+
@trigger_error('The profiler.username configuration key is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
193+
194+
return $v;
195+
})
196+
->end()
197+
->end()
198+
->scalarNode('password')
199+
->defaultValue('')
200+
->beforeNormalization()
201+
->always()
202+
->then(function ($v) {
203+
@trigger_error('The profiler.password configuration key is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
204+
205+
return $v;
206+
})
207+
->end()
208+
->end()
179209
->scalarNode('lifetime')->defaultValue(86400)->end()
180210
->arrayNode('matcher')
181211
->canBeUnset()

src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public function testDebugAllRoutes()
2525
$ret = $tester->execute(array('name' => null), array('decorated' => false));
2626

2727
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
28-
$this->assertContains('[router] Current routes', $tester->getDisplay());
28+
$this->assertContains('Path', $tester->getDisplay());
29+
$this->assertContains('/foo', $tester->getDisplay());
2930
}
3031

3132
public function testDebugSingleRoute()
@@ -34,7 +35,7 @@ public function testDebugSingleRoute()
3435
$ret = $tester->execute(array('name' => 'foo'), array('decorated' => false));
3536

3637
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
37-
$this->assertContains('[router] Route "foo"', $tester->getDisplay());
38+
$this->assertContains('Route Name | foo', $tester->getDisplay());
3839
}
3940

4041
/**

src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testWithMatchPath()
2727
$ret = $tester->execute(array('path_info' => '/foo', 'foo'), array('decorated' => false));
2828

2929
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
30-
$this->assertContains('[router] Route "foo"', $tester->getDisplay());
30+
$this->assertContains('Route Name | foo', $tester->getDisplay());
3131
}
3232

3333
public function testWithNotMatchPath()
Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
<comment>Path</comment> /hello/{name}
2-
<comment>Path Regex</comment> #^/hello(?:/(?P<name>[a-z]+))?$#s
3-
<comment>Host</comment> localhost
4-
<comment>Host Regex</comment> #^localhost$#si
5-
<comment>Scheme</comment> http|https
6-
<comment>Method</comment> GET|HEAD
7-
<comment>Class</comment> Symfony\Component\Routing\Route
8-
<comment>Defaults</comment> name: Joseph
9-
<comment>Requirements</comment> name: [a-z]+
10-
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
11-
opt1: val1
12-
opt2: val2
1+
+--------------+---------------------------------------------------------+
2+
| Property | Value |
3+
+--------------+---------------------------------------------------------+
4+
| Route Name | |
5+
| Path | /hello/{name} |
6+
| Path Regex | #^/hello(?:/(?P<name>[a-z]+))?$#s |
7+
| Host | localhost |
8+
| Host Regex | #^localhost$#si |
9+
| Scheme | http|https |
10+
| Method | GET|HEAD |
11+
| Requirements | name: [a-z]+ |
12+
| Class | Symfony\Component\Routing\Route |
13+
| Defaults | name: Joseph |
14+
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
15+
| | opt1: val1 |
16+
| | opt2: val2 |
17+
+--------------+---------------------------------------------------------+
Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
<comment>Path</comment> /name/add
2-
<comment>Path Regex</comment> #^/name/add$#s
3-
<comment>Host</comment> localhost
4-
<comment>Host Regex</comment> #^localhost$#si
5-
<comment>Scheme</comment> http|https
6-
<comment>Method</comment> PUT|POST
7-
<comment>Class</comment> Symfony\Component\Routing\Route
8-
<comment>Defaults</comment> NONE
9-
<comment>Requirements</comment> NO CUSTOM
10-
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
11-
opt1: val1
12-
opt2: val2
1+
+--------------+---------------------------------------------------------+
2+
| Property | Value |
3+
+--------------+---------------------------------------------------------+
4+
| Route Name | |
5+
| Path | /name/add |
6+
| Path Regex | #^/name/add$#s |
7+
| Host | localhost |
8+
| Host Regex | #^localhost$#si |
9+
| Scheme | http|https |
10+
| Method | PUT|POST |
11+
| Requirements | NO CUSTOM |
12+
| Class | Symfony\Component\Routing\Route |
13+
| Defaults | NONE |
14+
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
15+
| | opt1: val1 |
16+
| | opt2: val2 |
17+
+--------------+---------------------------------------------------------+

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<info>[router]</info> Current routes
21
+---------+----------+------------+-----------+---------------+
32
| Name | Method | Scheme | Host | Path |
43
+---------+----------+------------+-----------+---------------+

src/Symfony/Component/CssSelector/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CHANGELOG
44
2.8.0
55
-----
66

7-
* Added the ConverterInterface and the Converter implementation as a non-static API for the component.
7+
* Added the `CssSelectorConverter` class as a non-static API for the component.
88
* Deprecated the `CssSelector` static API of the component.
99

1010
2.1.0

src/Symfony/Component/CssSelector/ConverterInterface.php

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/Symfony/Component/CssSelector/Converter.php renamed to src/Symfony/Component/CssSelector/CssSelectorConverter.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
use Symfony\Component\CssSelector\XPath\Translator;
2020

2121
/**
22+
* CssSelectorConverter is the main entry point of the component and can convert CSS
23+
* selectors to XPath expressions.
24+
*
2225
* @author Christophe Coevoet <stof@notk.org>
2326
*/
24-
class Converter implements ConverterInterface
27+
class CssSelectorConverter
2528
{
2629
private $translator;
2730

@@ -45,7 +48,15 @@ public function __construct($html = true)
4548
}
4649

4750
/**
48-
* {@inheritdoc}
51+
* Translates a CSS expression to its XPath equivalent.
52+
*
53+
* Optionally, a prefix can be added to the resulting XPath
54+
* expression with the $prefix parameter.
55+
*
56+
* @param string $cssExpr The CSS expression.
57+
* @param string $prefix An optional prefix for the XPath expression.
58+
*
59+
* @return string
4960
*/
5061
public function toXPath($cssExpr, $prefix = 'descendant-or-self::')
5162
{

0 commit comments

Comments
 (0)
0