From 03f831108f7cea087be83cc6dd07d3419542a5ba Mon Sep 17 00:00:00 2001 From: Colin O'Dell Date: Sun, 19 Jul 2020 09:57:33 -0400 Subject: [PATCH] Fix checks for phpunit releases on Composer 2 (resolves #37601) --- bin/simple-phpunit | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/simple-phpunit b/bin/simple-phpunit index 27ea6037..7b5e3b16 100755 --- a/bin/simple-phpunit +++ b/bin/simple-phpunit @@ -117,7 +117,11 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ 'requires' => array('php' => '*'), ); - if (1 === count($info['versions'])) { + $stableVersions = array_filter($info['versions'], function($v) { + return !preg_match('/-dev$|^dev-/', $v); + }); + + if (!$stableVersions) { $passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress -s dev phpunit/phpunit phpunit-$PHPUNIT_VERSION \"$PHPUNIT_VERSION.*\""); } else { $passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress phpunit/phpunit phpunit-$PHPUNIT_VERSION \"$PHPUNIT_VERSION.*\"");