Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ae2634

Browse files
[ci] Collect and replay skipped tests
1 parent 491c12c commit 7ae2634

File tree

98 files changed

+291
-78
lines changed

Some content is hidden

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

98 files changed

+291
-78
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ install:
4848
- if [ "$deps" != "skip" ] && [ "$deps" != "no" ]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi;
4949

5050
script:
51-
- if [ "$deps" = "no" ]; then echo "$COMPONENTS" | parallel --gnu 'echo -e "\\nRunning {} tests"; $PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
51+
- if [ "$deps" = "no" ]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
5252
- if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi;
53-
- 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,legacy'; fi;
54-
- 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;
53+
- if [ "$deps" = "high" ]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data,legacy'; fi;
54+
- if [ "$deps" = "low" ]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
5555
- if [ "$deps" = "skip" ]; then echo 'This matrix line is skipped for pull requests.'; fi;

appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ init:
1414
- SET PHP=1
1515
- SET ANSICON=121x90 (121x90)
1616
- SET PHP_INI_MATRIX=php.ini-min php.ini-max
17+
- SET SYMFONY_PHPUNIT_SKIPPED_TESTS=phpunit.skipped
1718

1819
install:
1920
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
@@ -32,6 +33,7 @@ install:
3233
- IF %PHP%==1 cd ..
3334
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
3435
- IF %PHP%==1 copy /Y php.ini-development php.ini-min
36+
- IF %PHP%==1 echo max_execution_time=1200 >> php.ini-min
3537
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini-min
3638
- IF %PHP%==1 echo extension_dir=ext >> php.ini-min
3739
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini-min

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
"symfony/yaml": "self.version"
7373
},
7474
"require-dev": {
75-
"symfony/phpunit-bridge": "self.version",
7675
"doctrine/data-fixtures": "1.0.*",
7776
"doctrine/dbal": "~2.4",
7877
"doctrine/orm": "~2.4,>=2.4.5",

phpunit

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit")) {
2828
// Build a standalone phpunit without symfony/yaml
2929

3030
$oldPwd = getcwd();
31-
mkdir($PHPUNIT_DIR);
31+
@mkdir($PHPUNIT_DIR);
3232
chdir($PHPUNIT_DIR);
3333
if (extension_loaded('openssl') && ini_get('allow_url_fopen')) {
3434
stream_copy_to_stream(fopen("https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip", 'rb'), fopen("$PHPUNIT_VERSION.zip", 'wb'));
@@ -41,7 +41,9 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit")) {
4141
$zip->close();
4242
chdir("phpunit-$PHPUNIT_VERSION");
4343
passthru("$COMPOSER remove --no-update symfony/yaml");
44+
passthru("$COMPOSER require --dev --no-update symfony/phpunit-bridge \">=2.8@dev\"");
4445
passthru("$COMPOSER install --prefer-source --no-progress --ansi");
46+
symlink(realpath('../../src/Symfony/Bridge/PhpUnit/SkippedTestsListener.php'), './vendor/symfony/phpunit-bridge/SkippedTestsListener.php');
4547
chdir($oldPwd);
4648
}
4749

@@ -76,10 +78,13 @@ if ($phpIniMatrix) {
7678
if (isset($argv[1]) && 'symfony' === $argv[1]) {
7779
// Find Symfony components in plain php for Windows portability
7880

79-
$finder = new RecursiveDirectoryIterator(__DIR__.'/src/Symfony', FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::UNIX_PATHS);
81+
$oldPwd = getcwd();
82+
chdir(__DIR__);
83+
$finder = new RecursiveDirectoryIterator('src/Symfony', FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::UNIX_PATHS);
8084
$finder = new RecursiveIteratorIterator($finder);
8185
$finder->setMaxDepth(3);
8286

87+
$skippedTests = isset($_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS']) ? $_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS'] : false;
8388
$runningProcs = array();
8489

8590
foreach ($finder as $file => $fileInfo) {
@@ -88,6 +93,10 @@ if (isset($argv[1]) && 'symfony' === $argv[1]) {
8893

8994
// Run phpunit tests in parallel
9095

96+
if ($skippedTests) {
97+
putenv("SYMFONY_PHPUNIT_SKIPPED_TESTS=$component/$skippedTests");
98+
}
99+
91100
$c = ProcessUtils::escapeArgument($component);
92101

93102
if ($proc = proc_open(sprintf($cmd, $c, " > $c/phpunit.stdout 2> $c/phpunit.stderr"), array(), $pipes)) {
@@ -98,6 +107,7 @@ if (isset($argv[1]) && 'symfony' === $argv[1]) {
98107
}
99108
}
100109
}
110+
chdir($oldPwd);
101111

102112
// Fixes for colors support on appveyor
103113
// See https://github.com/appveyor/ci/issues/373
@@ -139,6 +149,9 @@ if (isset($argv[1]) && 'symfony' === $argv[1]) {
139149
}
140150
unlink($file);
141151
}
152+
if ($skippedTests) {
153+
@unlink("$component/$skippedTests");
154+
}
142155

143156
if ($procStatus) {
144157
$exit = 1;

phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@
4343
</exclude>
4444
</whitelist>
4545
</filter>
46+
47+
<listeners>
48+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
49+
</listeners>
4650
</phpunit>

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"doctrine/common": "~2.4"
2121
},
2222
"require-dev": {
23-
"symfony/phpunit-bridge": "~2.7|~3.0.0",
2423
"symfony/stopwatch": "~2.2|~3.0.0",
2524
"symfony/dependency-injection": "~2.2|~3.0.0",
2625
"symfony/form": "~2.8|~3.0.0",

src/Symfony/Bridge/Doctrine/phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@
2525
</exclude>
2626
</whitelist>
2727
</filter>
28+
29+
<listeners>
30+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
31+
</listeners>
2832
</phpunit>

src/Symfony/Bridge/Monolog/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"monolog/monolog": "~1.11"
2121
},
2222
"require-dev": {
23-
"symfony/phpunit-bridge": "~2.7|~3.0.0",
2423
"symfony/http-kernel": "~2.4|~3.0.0",
2524
"symfony/console": "~2.4|~3.0.0",
2625
"symfony/event-dispatcher": "~2.2|~3.0.0"

src/Symfony/Bridge/Monolog/phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@
2525
</exclude>
2626
</whitelist>
2727
</filter>
28+
29+
<listeners>
30+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
31+
</listeners>
2832
</phpunit>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
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\Bridge\PhpUnit;
13+
14+
/**
15+
* Collects and replays skipped tests.
16+
*
17+
* @author Nicolas Grekas <[email protected]>
18+
*/
19+
class SkippedTestsListener extends \PHPUnit_Framework_BaseTestListener
20+
{
21+
private $state = -1;
22+
private $skippedFile = false;
23+
private $wasSkipped = array();
24+
private $isSkipped = array();
25+
26+
public function __destruct()
27+
{
28+
if (0 < $this->state) {
29+
file_put_contents($this->skippedFile, '<?php return '.var_export($this->isSkipped, true).';');
30+
}
31+
}
32+
33+
public function startTestSuite(\PHPUnit_Framework_TestSuite $suite)
34+
{
35+
$suiteName = $suite->getName();
36+
37+
if (-1 === $this->state) {
38+
echo "Testing $suiteName\n";
39+
$this->state = 0;
40+
41+
if (!class_exists('Doctrine\Common\Annotations\AnnotationRegistry', false) && class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
42+
AnnotationRegistry::registerLoader('class_exists');
43+
}
44+
45+
if ($this->skippedFile = getenv('SYMFONY_PHPUNIT_SKIPPED_TESTS')) {
46+
$this->state = 1;
47+
48+
if (file_exists($this->skippedFile)) {
49+
$this->state = 2;
50+
51+
if (!$this->wasSkipped = require $this->skippedFile) {
52+
exit("All tests already ran successfully.\n");
53+
}
54+
}
55+
}
56+
} elseif (2 === $this->state) {
57+
$skipped = array();
58+
foreach ($suite->tests() as $test) {
59+
if (!$test instanceof \PHPUnit_Framework_TestCase
60+
|| isset($this->wasSkipped[$suiteName]['*'])
61+
|| isset($this->wasSkipped[$suiteName][$test->getName()])) {
62+
$skipped[] = $test;
63+
}
64+
}
65+
$suite->setTests($skipped);
66+
}
67+
}
68+
69+
public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $time)
70+
{
71+
if (0 < $this->state) {
72+
if ($test instanceof \PHPUnit_Framework_TestCase) {
73+
$class = get_class($test);
74+
$method = $test->getName();
75+
} else {
76+
$class = $test->getName();
77+
$method = '*';
78+
}
79+
80+
$this->isSkipped[$class][$method] = 1;
81+
}
82+
}
83+
}

src/Symfony/Bridge/PhpUnit/phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@
2525
</exclude>
2626
</whitelist>
2727
</filter>
28+
29+
<listeners>
30+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
31+
</listeners>
2832
</phpunit>

src/Symfony/Bridge/ProxyManager/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"ocramius/proxy-manager": "~0.4|~1.0"
2222
},
2323
"require-dev": {
24-
"symfony/phpunit-bridge": "~2.7|~3.0.0",
2524
"symfony/config": "~2.3|~3.0.0"
2625
},
2726
"autoload": {

src/Symfony/Bridge/ProxyManager/phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@
2626
</exclude>
2727
</whitelist>
2828
</filter>
29+
30+
<listeners>
31+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
32+
</listeners>
2933
</phpunit>

src/Symfony/Bridge/Swiftmailer/composer.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"php": ">=5.3.9",
2020
"swiftmailer/swiftmailer": ">=4.2.0,<6.0-dev"
2121
},
22-
"require-dev": {
23-
"symfony/phpunit-bridge": "~2.7|~3.0.0"
24-
},
2522
"suggest": {
2623
"symfony/http-kernel": ""
2724
},

src/Symfony/Bridge/Twig/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"twig/twig": "~1.20|~2.0"
2121
},
2222
"require-dev": {
23-
"symfony/phpunit-bridge": "~2.7|~3.0.0",
2423
"symfony/asset": "~2.7|~3.0.0",
2524
"symfony/finder": "~2.3|~3.0.0",
2625
"symfony/form": "~2.8",

src/Symfony/Bridge/Twig/phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@
2626
</exclude>
2727
</whitelist>
2828
</filter>
29+
30+
<listeners>
31+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
32+
</listeners>
2933
</phpunit>

src/Symfony/Bundle/DebugBundle/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"symfony/var-dumper": "~2.6|~3.0.0"
2323
},
2424
"require-dev": {
25-
"symfony/phpunit-bridge": "~2.7|~3.0.0",
2625
"symfony/config": "~2.3|~3.0.0",
2726
"symfony/dependency-injection": "~2.3|~3.0.0",
2827
"symfony/web-profiler-bundle": "~2.3|~3.0.0"

src/Symfony/Bundle/DebugBundle/phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@
2626
</exclude>
2727
</whitelist>
2828
</filter>
29+
30+
<listeners>
31+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
32+
</listeners>
2933
</phpunit>

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"doctrine/annotations": "~1.0"
3535
},
3636
"require-dev": {
37-
"symfony/phpunit-bridge": "~2.7|~3.0.0",
3837
"symfony/browser-kit": "~2.4|~3.0.0",
3938
"symfony/console": "~2.8|~3.0.0",
4039
"symfony/css-selector": "~2.0,>=2.0.5|~3.0.0",

src/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@
2626
</exclude>
2727
</whitelist>
2828
</filter>
29+
30+
<listeners>
31+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
32+
</listeners>
2933
</phpunit>

src/Symfony/Bundle/SecurityBundle/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"symfony/http-kernel": "~2.2|~3.0.0"
2323
},
2424
"require-dev": {
25-
"symfony/phpunit-bridge": "~2.7|~3.0.0",
2625
"symfony/browser-kit": "~2.4|~3.0.0",
2726
"symfony/config": "~2.8|~3.0.0",
2827
"symfony/console": "~2.7|~3.0.0",

src/Symfony/Bundle/SecurityBundle/phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@
2626
</exclude>
2727
</whitelist>
2828
</filter>
29+
30+
<listeners>
31+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
32+
</listeners>
2933
</phpunit>

src/Symfony/Bundle/TwigBundle/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"symfony/http-kernel": "~2.7"
2424
},
2525
"require-dev": {
26-
"symfony/phpunit-bridge": "~2.7|~3.0.0",
2726
"symfony/stopwatch": "~2.2|~3.0.0",
2827
"symfony/dependency-injection": "~2.6,>=2.6.6|~3.0.0",
2928
"symfony/expression-language": "~2.4|~3.0.0",

src/Symfony/Bundle/TwigBundle/phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@
2626
</exclude>
2727
</whitelist>
2828
</filter>
29+
30+
<listeners>
31+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
32+
</listeners>
2933
</phpunit>

src/Symfony/Bundle/WebProfilerBundle/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"symfony/twig-bridge": "~2.7|~3.0.0"
2323
},
2424
"require-dev": {
25-
"symfony/phpunit-bridge": "~2.7|~3.0.0",
2625
"symfony/config": "~2.2|~3.0.0",
2726
"symfony/console": "~2.3|~3.0.0",
2827
"symfony/dependency-injection": "~2.2|~3.0.0",

src/Symfony/Bundle/WebProfilerBundle/phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@
2626
</exclude>
2727
</whitelist>
2828
</filter>
29+
30+
<listeners>
31+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
32+
</listeners>
2933
</phpunit>

src/Symfony/Component/Asset/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"symfony/http-foundation": ""
2323
},
2424
"require-dev": {
25-
"symfony/phpunit-bridge": "~2.7|~3.0.0",
2625
"symfony/http-foundation": "~2.4"
2726
},
2827
"autoload": {

src/Symfony/Component/Asset/phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@
2525
</exclude>
2626
</whitelist>
2727
</filter>
28+
29+
<listeners>
30+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
31+
</listeners>
2832
</phpunit>

src/Symfony/Component/BrowserKit/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0"
2121
},
2222
"require-dev": {
23-
"symfony/phpunit-bridge": "~2.7|~3.0.0",
2423
"symfony/process": "~2.0,>=2.0.5|~3.0.0",
2524
"symfony/css-selector": "~2.0,>=2.0.5|~3.0.0"
2625
},

src/Symfony/Component/BrowserKit/phpunit.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@
2626
</exclude>
2727
</whitelist>
2828
</filter>
29+
30+
<listeners>
31+
<listener class="Symfony\Bridge\PhpUnit\SkippedTestsListener" />
32+
</listeners>
2933
</phpunit>

0 commit comments

Comments
 (0)