feature #20256 [PhpUnitBridge] Allow configuring removed deps and phpunit versions (nicolas-grekas)
This PR was merged into the 3.2-dev branch.
Discussion
----------
[PhpUnitBridge] Allow configuring removed deps and phpunit versions
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | -
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/7074
Allowing greater reuse of the wrapper.
Commits
-------
fb1c5b8
[PhpUnitBridge] Allow configuring removed deps and phpunit versions
This commit is contained in:
commit
60e6af5c3a
@ -16,7 +16,7 @@
|
||||
error_reporting(-1);
|
||||
|
||||
// PHPUnit 4.8 does not support PHP 7, while 5.1 requires PHP 5.6+
|
||||
$PHPUNIT_VERSION = PHP_VERSION_ID >= 50600 ? '5.1' : '4.8';
|
||||
$PHPUNIT_VERSION = PHP_VERSION_ID >= 50600 ? getenv('SYMFONY_PHPUNIT_VERSION') ?: '5.3' : '4.8';
|
||||
$oldPwd = getcwd();
|
||||
$PHPUNIT_DIR = getenv('SYMFONY_PHPUNIT_DIR') ?: (__DIR__.'/.phpunit');
|
||||
$PHP = defined('PHP_BINARY') ? PHP_BINARY : 'php';
|
||||
@ -29,8 +29,8 @@ $COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rt
|
||||
? $PHP.' '.escapeshellarg($COMPOSER)
|
||||
: 'composer';
|
||||
|
||||
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__) !== @file_get_contents("$PHPUNIT_DIR/.$PHPUNIT_VERSION.md5")) {
|
||||
// Build a standalone phpunit without symfony/yaml nor prophecy
|
||||
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__)."\n".getenv('SYMFONY_PHPUNIT_REMOVE') !== @file_get_contents("$PHPUNIT_DIR/.$PHPUNIT_VERSION.md5")) {
|
||||
// Build a standalone phpunit without symfony/yaml nor prophecy by default
|
||||
|
||||
@mkdir($PHPUNIT_DIR);
|
||||
chdir($PHPUNIT_DIR);
|
||||
@ -48,8 +48,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
|
||||
$zip->extractTo(getcwd());
|
||||
$zip->close();
|
||||
chdir("phpunit-$PHPUNIT_VERSION");
|
||||
passthru("$COMPOSER remove --no-update phpspec/prophecy");
|
||||
passthru("$COMPOSER remove --no-update symfony/yaml");
|
||||
passthru("$COMPOSER remove --no-update ".(getenv('SYMFONY_PHPUNIT_REMOVE') ?: 'phpspec/prophecy symfony/yaml'));
|
||||
if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
|
||||
passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
|
||||
}
|
||||
@ -68,7 +67,7 @@ Symfony\Bridge\PhpUnit\TextUI\Command::main();
|
||||
EOPHP
|
||||
);
|
||||
chdir('..');
|
||||
file_put_contents(".$PHPUNIT_VERSION.md5", md5_file(__FILE__));
|
||||
file_put_contents(".$PHPUNIT_VERSION.md5", md5_file(__FILE__)."\n".getenv('SYMFONY_PHPUNIT_REMOVE'));
|
||||
chdir($oldPwd);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user