@@ -26,16 +26,16 @@ if (PHP_VERSION_ID >= 70200) {
26
26
$ PHPUNIT_VERSION = '4.8 ' ;
27
27
}
28
28
29
- if (file_exists (($ path = dirname (__DIR__ )).'/composer.json ' )) {
30
- if (file_exists ($ path .'/vendor/symfony/phpunit-bridge/composer.json ' )) {
31
- $ path .= '/vendor/symfony/phpunit-bridge ' ;
29
+ $ root = __DIR__ ;
30
+ while (!file_exists ($ root .'/composer.json ' ) || file_exists ($ root .'/bin/simple-phpunit ' )) {
31
+ if ($ root === dirname ($ root )) {
32
+ break ;
32
33
}
33
- } elseif (file_exists ($ path .'/symfony/phpunit-bridge/composer.json ' )) {
34
- $ path .= '/symfony/phpunit-bridge ' ;
34
+ $ root = dirname ($ root );
35
35
}
36
36
37
37
$ oldPwd = getcwd ();
38
- $ PHPUNIT_DIR = getenv ('SYMFONY_PHPUNIT_DIR ' ) ?: (dirname ( dirname ( __DIR__ ) === $ path ? $ path : __DIR__ ). ' /.phpunit ' );
38
+ $ PHPUNIT_DIR = getenv ('SYMFONY_PHPUNIT_DIR ' ) ?: ($ root . ' /vendor/bin /.phpunit ' );
39
39
$ PHP = defined ('PHP_BINARY ' ) ? PHP_BINARY : 'php ' ;
40
40
$ PHP = escapeshellarg ($ PHP );
41
41
if ('phpdbg ' === PHP_SAPI ) {
@@ -76,9 +76,14 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
76
76
if (5.1 <= $ PHPUNIT_VERSION && $ PHPUNIT_VERSION < 5.4 ) {
77
77
passthru ("$ COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0 \"" );
78
78
}
79
- passthru ( " $ COMPOSER require --no-update symfony/phpunit-bridge \" * \"" );
80
- if ( file_exists ( $ path )) {
79
+ if ( file_exists ( $ path = $ root . ' /vendor/ symfony/phpunit-bridge' )) {
80
+ passthru ( " $ COMPOSER require --no-update symfony/phpunit-bridge \" *@dev \"" );
81
81
passthru ("$ COMPOSER config repositories.phpunit-bridge path " .escapeshellarg (str_replace ('/ ' , DIRECTORY_SEPARATOR , $ path )));
82
+ if ('\\' === DIRECTORY_SEPARATOR ) {
83
+ file_put_contents ('composer.json ' , preg_replace ('/^( {8})"phpunit-bridge": \{$/m ' , "$0 \n$1 " .'"options": {"symlink": false}, ' , file_get_contents ('composer.json ' )));
84
+ }
85
+ } else {
86
+ passthru ("$ COMPOSER require --no-update symfony/phpunit-bridge \"* \"" );
82
87
}
83
88
$ prevRoot = getenv ('COMPOSER_ROOT_VERSION ' );
84
89
putenv ("COMPOSER_ROOT_VERSION= $ PHPUNIT_VERSION .99 " );
0 commit comments