bug #31210 [PhpUnitBridge] fix reading phpunit.xml on bootstrap (nicolas-grekas)

This PR was merged into the 4.2 branch.

Discussion
----------

[PhpUnitBridge] fix reading phpunit.xml on bootstrap

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Matches https://github.com/symfony/recipes/pull/561

Commits
-------

1d55f800e4 [PhpUnitBridge] fix reading phpunit.xml on bootstrap
This commit is contained in:
Fabien Potencier 2019-04-24 08:59:04 +02:00
commit 0773baf1bc

View File

@ -37,6 +37,9 @@ $getEnvVar = function ($name, $default = false) {
}
if (false !== $phpunitConfig) {
$var = new DOMXpath($phpunitConfig);
foreach ($var->query('//php/server[@name="'.$name.'"]') as $var) {
return $var->getAttribute('value');
}
foreach ($var->query('//php/env[@name="'.$name.'"]') as $var) {
return $var->getAttribute('value');
}
@ -92,7 +95,7 @@ $COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rt
: 'composer';
$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy symfony/yaml');
$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'.($PHPUNIT_VERSION < 6.0 ? ' symfony/yaml': ''));
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__)."\n".$SYMFONY_PHPUNIT_REMOVE !== @file_get_contents("$PHPUNIT_DIR/.$PHPUNIT_VERSION.md5")) {
// Build a standalone phpunit without symfony/yaml nor prophecy by default