@@ -24,15 +24,19 @@ if (!file_exists($COMPOSER = __DIR__.'/composer.phar')) {
24
24
$ PHP = ProcessUtils::escapeArgument ($ PHP );
25
25
$ COMPOSER = $ PHP .' ' .ProcessUtils::escapeArgument ($ COMPOSER );
26
26
27
- if (!file_exists ("$ PHPUNIT_DIR /phpunit- $ PHPUNIT_VERSION /phpunit " )) {
27
+ if (!file_exists ("$ PHPUNIT_DIR /phpunit- $ PHPUNIT_VERSION /phpunit " ) || md5_file ( __FILE__ ) !== @ file_get_contents ( " $ PHPUNIT_DIR /.md5 " ) || ( isset ( $ argv [ 1 ]) && ' install ' === $ argv [ 1 ]) ) {
28
28
// Build a standalone phpunit without symfony/yaml
29
29
30
30
$ oldPwd = getcwd ();
31
31
@mkdir ($ PHPUNIT_DIR );
32
32
chdir ($ PHPUNIT_DIR );
33
+ if (file_exists ("phpunit- $ PHPUNIT_VERSION " )) {
34
+ passthru (sprintf ('\\' === DIRECTORY_SEPARATOR ? 'del /S /F /Q %s & rmdir %1$s >nul 2>&1 ' : 'rm -rf %s ' , "phpunit- $ PHPUNIT_VERSION " ));
35
+ }
33
36
if (extension_loaded ('openssl ' ) && ini_get ('allow_url_fopen ' )) {
34
37
stream_copy_to_stream (fopen ("https://github.com/sebastianbergmann/phpunit/archive/ $ PHPUNIT_VERSION .zip " , 'rb ' ), fopen ("$ PHPUNIT_VERSION .zip " , 'wb ' ));
35
38
} else {
39
+ @unlink ("$ PHPUNIT_VERSION .zip " );
36
40
passthru ("wget https://github.com/sebastianbergmann/phpunit/archive/ $ PHPUNIT_VERSION .zip " );
37
41
}
38
42
$ zip = new ZipArchive ();
@@ -43,7 +47,14 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit")) {
43
47
passthru ("$ COMPOSER remove --no-update symfony/yaml " );
44
48
passthru ("$ COMPOSER require --dev --no-update symfony/phpunit-bridge \">=2.8@dev \"" );
45
49
passthru ("$ COMPOSER install --prefer-source --no-progress --ansi " );
50
+ chdir ('.. ' );
51
+ if (file_exists ('../src/Symfony/Bridge/PhpUnit ' ) && `git diff --name-only HEAD^ -- ../src/Symfony/Bridge/PhpUnit `) {
52
+ 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 " )));
53
+ symlink (realpath ('../src/Symfony/Bridge/PhpUnit ' ), "phpunit- $ PHPUNIT_VERSION /vendor/symfony/phpunit-bridge " );
54
+ }
55
+ file_put_contents ('.md5 ' , md5_file (__FILE__ ));
46
56
chdir ($ oldPwd );
57
+
47
58
}
48
59
49
60
$ cmd = array_map ('Symfony\Component\Process\ProcessUtils::escapeArgument ' , $ argv );
0 commit comments