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

Skip to content

Commit 34add38

Browse files
[PhpUnitBridge] Allow configuring removed deps and phpunit versions
1 parent 4eeb1f0 commit 34add38

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
error_reporting(-1);
1717

1818
// PHPUnit 4.8 does not support PHP 7, while 5.1 requires PHP 5.6+
19-
$PHPUNIT_VERSION = PHP_VERSION_ID >= 50600 ? '5.1' : '4.8';
19+
$PHPUNIT_VERSION = PHP_VERSION_ID >= 50600 ? getenv('SYMFONY_PHPUNIT_VERSION') ?: '5.1' : '4.8';
2020
$oldPwd = getcwd();
2121
$PHPUNIT_DIR = getenv('SYMFONY_PHPUNIT_DIR') ?: (__DIR__.'/.phpunit');
2222
$PHP = defined('PHP_BINARY') ? PHP_BINARY : 'php';
@@ -29,8 +29,8 @@ $COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rt
2929
? $PHP.' '.escapeshellarg($COMPOSER)
3030
: 'composer';
3131

32-
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__) !== @file_get_contents("$PHPUNIT_DIR/.$PHPUNIT_VERSION.md5")) {
33-
// Build a standalone phpunit without symfony/yaml nor prophecy
32+
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")) {
33+
// Build a standalone phpunit without symfony/yaml nor prophecy by default
3434

3535
@mkdir($PHPUNIT_DIR);
3636
chdir($PHPUNIT_DIR);
@@ -48,8 +48,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
4848
$zip->extractTo(getcwd());
4949
$zip->close();
5050
chdir("phpunit-$PHPUNIT_VERSION");
51-
passthru("$COMPOSER remove --no-update phpspec/prophecy");
52-
passthru("$COMPOSER remove --no-update symfony/yaml");
51+
passthru("$COMPOSER remove --no-update ".(getenv('SYMFONY_PHPUNIT_REMOVE') ?: 'phpspec/prophecy symfony/yaml'));
5352
if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
5453
passthru("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
5554
}
@@ -68,7 +67,7 @@ Symfony\Bridge\PhpUnit\TextUI\Command::main();
6867
EOPHP
6968
);
7069
chdir('..');
71-
file_put_contents(".$PHPUNIT_VERSION.md5", md5_file(__FILE__));
70+
file_put_contents(".$PHPUNIT_VERSION.md5", md5_file(__FILE__)."\n".getenv('SYMFONY_PHPUNIT_REMOVE'));
7271
chdir($oldPwd);
7372

7473
}

0 commit comments

Comments
 (0)