Skip to content

Commit 0c5f30d

Browse files
Merge branch '4.4' into 5.0
* 4.4: [PhpUnitBridge] fix leftover [PhpUnitBridge] fix installing under PHP >= 8 Use ">=" for the "php" requirement bump icu 67.1
2 parents 0e67fb7 + 6745a1e commit 0c5f30d

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

bin/simple-phpunit.php

+28-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,31 @@
163163
rename("$PHPUNIT_VERSION_DIR", "$PHPUNIT_VERSION_DIR.old");
164164
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s' : 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old"));
165165
}
166-
$passthruOrFail("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
166+
167+
$info = [];
168+
foreach (explode("\n", `$COMPOSER info -a -n phpunit/phpunit "$PHPUNIT_VERSION.*"`) as $line) {
169+
$line = rtrim($line);
170+
171+
if (!$info && preg_match('/^versions +: /', $line)) {
172+
$info['versions'] = explode(', ', ltrim(substr($line, 9), ': '));
173+
} elseif (isset($info['requires'])) {
174+
if ('' === $line) {
175+
break;
176+
}
177+
178+
$line = explode(' ', $line, 2);
179+
$info['requires'][$line[0]] = $line[1];
180+
} elseif ($info && 'requires' === $line) {
181+
$info['requires'] = [];
182+
}
183+
}
184+
185+
if (1 === \count($info['versions'])) {
186+
$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.*\"");
187+
} else {
188+
$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.*\"");
189+
}
190+
167191
@copy("$PHPUNIT_VERSION_DIR/phpunit.xsd", 'phpunit.xsd');
168192
chdir("$PHPUNIT_VERSION_DIR");
169193
if ($SYMFONY_PHPUNIT_REMOVE) {
@@ -173,6 +197,9 @@
173197
$passthruOrFail("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
174198
}
175199

200+
if ($info['requires']['php'] !== $phpVersion = preg_replace('{\^([\d\.]++)$}', '>=$1', $info['requires']['php'])) {
201+
$passthruOrFail("$COMPOSER require --no-update \"php:$phpVersion\"");
202+
}
176203
$passthruOrFail("$COMPOSER config --unset platform.php");
177204
if (file_exists($path = $root.'/vendor/symfony/phpunit-bridge')) {
178205
$passthruOrFail("$COMPOSER require --no-update symfony/phpunit-bridge \"*@dev\"");

0 commit comments

Comments
 (0)