Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,31 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
rename("phpunit-$PHPUNIT_VERSION", "phpunit-$PHPUNIT_VERSION.old");
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s': 'rm -rf %s', "phpunit-$PHPUNIT_VERSION.old"));
}

$info = array();
foreach (explode("\n", `$COMPOSER info -a -n phpunit/phpunit "$PHPUNIT_VERSION.*"`) as $line) {
$line = rtrim($line);

if (!$info && preg_match('/^versions +: /', $line)) {
$info['versions'] = explode(', ', ltrim(substr($line, 9), ': '));
} elseif (isset($info['requires'])) {
if ('' === $line) {
break;
}

$line = explode(' ', $line, 2);
$info['requires'][$line[0]] = $line[1];
} elseif ($info && 'requires' === $line) {
$info['requires'] = array();
}
}

if (1 === \count($info['versions'])) {
$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.*\"");
} else {
$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.*\"");
}

$passthruOrFail("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit phpunit-$PHPUNIT_VERSION \"$PHPUNIT_VERSION.*\"");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot to remove that line

@copy("phpunit-$PHPUNIT_VERSION/phpunit.xsd", 'phpunit.xsd');
chdir("phpunit-$PHPUNIT_VERSION");
Expand All @@ -97,6 +122,9 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
$passthruOrFail("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
}

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