@@ -87,6 +87,31 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
87
87
rename ("phpunit- $ PHPUNIT_VERSION " , "phpunit- $ PHPUNIT_VERSION .old " );
88
88
passthru (sprintf ('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s ' : 'rm -rf %s ' , "phpunit- $ PHPUNIT_VERSION .old " ));
89
89
}
90
+
91
+ $ info = array ();
92
+ foreach (explode ("\n" , `$ COMPOSER info -a -n phpunit/phpunit " $ PHPUNIT_VERSION .*" `) as $ line ) {
93
+ $ line = rtrim ($ line );
94
+
95
+ if (!$ info && preg_match ('/^versions +: / ' , $ line )) {
96
+ $ info ['versions ' ] = explode (', ' , ltrim (substr ($ line , 9 ), ': ' ));
97
+ } elseif (isset ($ info ['requires ' ])) {
98
+ if ('' === $ line ) {
99
+ break ;
100
+ }
101
+
102
+ $ line = explode (' ' , $ line , 2 );
103
+ $ info ['requires ' ][$ line [0 ]] = $ line [1 ];
104
+ } elseif ($ info && 'requires ' === $ line ) {
105
+ $ info ['requires ' ] = array ();
106
+ }
107
+ }
108
+
109
+ if (1 === \count ($ info ['versions ' ])) {
110
+ $ passthruOrFail ("$ COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi -s dev phpunit/phpunit $ PHPUNIT_VERSION_DIR \"$ PHPUNIT_VERSION .* \"" );
111
+ } else {
112
+ $ passthruOrFail ("$ COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit $ PHPUNIT_VERSION_DIR \"$ PHPUNIT_VERSION .* \"" );
113
+ }
114
+
90
115
$ passthruOrFail ("$ COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit phpunit- $ PHPUNIT_VERSION \"$ PHPUNIT_VERSION .* \"" );
91
116
@copy ("phpunit- $ PHPUNIT_VERSION /phpunit.xsd " , 'phpunit.xsd ' );
92
117
chdir ("phpunit- $ PHPUNIT_VERSION " );
@@ -97,6 +122,9 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
97
122
$ passthruOrFail ("$ COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0 \"" );
98
123
}
99
124
125
+ if ($ info ['requires ' ]['php ' ] !== $ phpVersion = preg_replace ('{\^([\d\.]++)$} ' , '>=$1 ' , $ info ['requires ' ]['php ' ])) {
126
+ $ passthruOrFail ("$ COMPOSER require --no-update \"php: $ phpVersion \"" );
127
+ }
100
128
$ passthruOrFail ("$ COMPOSER config --unset platform.php " );
101
129
if (file_exists ($ path = $ root .'/vendor/symfony/phpunit-bridge ' )) {
102
130
$ passthruOrFail ("$ COMPOSER require --no-update symfony/phpunit-bridge \"*@dev \"" );
0 commit comments