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

Skip to content

Commit fb172ca

Browse files
committed
feature #26800 [PhpUnitBridge] Search for SYMFONY_PHPUNIT_REMOVE env var in phpunit.xml then phpunit.xml.dist (lyrixx)
This PR was merged into the 4.1-dev branch. Discussion ---------- [PhpUnitBridge] Search for SYMFONY_PHPUNIT_REMOVE env var in phpunit.xml then phpunit.xml.dist | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | --- using the env var could be a bit annoying + not everyone may know this. So adding it to the `phpunit.xml.dist` file make sens IHMO Commits ------- 5e2d43e [PhpUnitBridge] Search for SYMFONY_PHPUNIT_REMOVE env var in phpunit.xml then phpunit.xml.dist
2 parents 5b4e1c5 + 5e2d43e commit fb172ca

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/Symfony/Bridge/PhpUnit/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
4.1.0
5+
-----
6+
7+
* Search for `SYMFONY_PHPUNIT_REMOVE` env var in `phpunit.xml` then
8+
`phpunit.xml.dist`
9+
410
4.0.0
511
-----
612

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,21 @@ $COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rt
5353

5454
if (false === $SYMFONY_PHPUNIT_REMOVE = getenv('SYMFONY_PHPUNIT_REMOVE')) {
5555
$SYMFONY_PHPUNIT_REMOVE = 'phpspec/prophecy symfony/yaml';
56+
57+
$phpunitConfigFilename = null;
58+
if (file_exists('phpunit.xml')) {
59+
$phpunitConfigFilename = 'phpunit.xml';
60+
} elseif (file_exists('phpunit.xml.dist')) {
61+
$phpunitConfigFilename = 'phpunit.xml.dist';
62+
}
63+
if ($phpunitConfigFilename) {
64+
$xml = new DomDocument();
65+
$xml->load($phpunitConfigFilename);
66+
$var = (new DOMXpath($xml))->query('//php/env[@name="SYMFONY_PHPUNIT_REMOVE"]')[0];
67+
if ($var) {
68+
$SYMFONY_PHPUNIT_REMOVE = $var->getAttribute('value');
69+
}
70+
}
5671
}
5772

5873
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__)."\n".$SYMFONY_PHPUNIT_REMOVE !== @file_get_contents("$PHPUNIT_DIR/.$PHPUNIT_VERSION.md5")) {

0 commit comments

Comments
 (0)