Merge branch '2.7' into 2.8
* 2.7: [phpunit] Upgrade when a change is detected and when install subcommand is used
This commit is contained in:
commit
cfbda28e21
13
phpunit
13
phpunit
@ -24,15 +24,19 @@ if (!file_exists($COMPOSER = __DIR__.'/composer.phar')) {
|
|||||||
$PHP = ProcessUtils::escapeArgument($PHP);
|
$PHP = ProcessUtils::escapeArgument($PHP);
|
||||||
$COMPOSER = $PHP.' '.ProcessUtils::escapeArgument($COMPOSER);
|
$COMPOSER = $PHP.' '.ProcessUtils::escapeArgument($COMPOSER);
|
||||||
|
|
||||||
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit")) {
|
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__) !== @file_get_contents("$PHPUNIT_DIR/.md5") || (isset($argv[1]) && 'install' === $argv[1])) {
|
||||||
// Build a standalone phpunit without symfony/yaml
|
// Build a standalone phpunit without symfony/yaml
|
||||||
|
|
||||||
$oldPwd = getcwd();
|
$oldPwd = getcwd();
|
||||||
@mkdir($PHPUNIT_DIR);
|
@mkdir($PHPUNIT_DIR);
|
||||||
chdir($PHPUNIT_DIR);
|
chdir($PHPUNIT_DIR);
|
||||||
|
if (file_exists("phpunit-$PHPUNIT_VERSION")) {
|
||||||
|
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'del /S /F /Q %s & rmdir %1$s >nul 2>&1': 'rm -rf %s', "phpunit-$PHPUNIT_VERSION"));
|
||||||
|
}
|
||||||
if (extension_loaded('openssl') && ini_get('allow_url_fopen')) {
|
if (extension_loaded('openssl') && ini_get('allow_url_fopen')) {
|
||||||
stream_copy_to_stream(fopen("https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip", 'rb'), fopen("$PHPUNIT_VERSION.zip", 'wb'));
|
stream_copy_to_stream(fopen("https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip", 'rb'), fopen("$PHPUNIT_VERSION.zip", 'wb'));
|
||||||
} else {
|
} else {
|
||||||
|
@unlink("$PHPUNIT_VERSION.zip");
|
||||||
passthru("wget https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip");
|
passthru("wget https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip");
|
||||||
}
|
}
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
@ -43,7 +47,14 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit")) {
|
|||||||
passthru("$COMPOSER remove --no-update symfony/yaml");
|
passthru("$COMPOSER remove --no-update symfony/yaml");
|
||||||
passthru("$COMPOSER require --dev --no-update symfony/phpunit-bridge \">=2.8@dev\"");
|
passthru("$COMPOSER require --dev --no-update symfony/phpunit-bridge \">=2.8@dev\"");
|
||||||
passthru("$COMPOSER install --prefer-source --no-progress --ansi");
|
passthru("$COMPOSER install --prefer-source --no-progress --ansi");
|
||||||
|
chdir('..');
|
||||||
|
if (file_exists('../src/Symfony/Bridge/PhpUnit') && `git diff --name-only HEAD^ -- ../src/Symfony/Bridge/PhpUnit`) {
|
||||||
|
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'del /S /F /Q %s & rmdir %1$s >nul 2>&1': 'rm -rf %s', str_replace('/', DIRECTORY_SEPARATOR, "phpunit-$PHPUNIT_VERSION/vendor/symfony/phpunit-bridge")));
|
||||||
|
symlink(realpath('../src/Symfony/Bridge/PhpUnit'), "phpunit-$PHPUNIT_VERSION/vendor/symfony/phpunit-bridge");
|
||||||
|
}
|
||||||
|
file_put_contents('.md5', md5_file(__FILE__));
|
||||||
chdir($oldPwd);
|
chdir($oldPwd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmd = array_map('Symfony\Component\Process\ProcessUtils::escapeArgument', $argv);
|
$cmd = array_map('Symfony\Component\Process\ProcessUtils::escapeArgument', $argv);
|
||||||
|
Reference in New Issue
Block a user