10000 [PhpUnitBridge] install PHPUnit 7 on PHP 7.1 and fix requirement for … · symfony/symfony@fb107eb · GitHub
[go: up one dir, main page]

Skip to content

Commit fb107eb

Browse files
committed
[PhpUnitBridge] install PHPUnit 7 on PHP 7.1 and fix requirement for PHPUnit 6
1 parent c7fe1b6 commit fb107eb

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

phpunit

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,22 @@ if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
77
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";
88
exit(1);
99
}
10-
if (\PHP_VERSION_ID >= 70000 && !getenv('SYMFONY_PHPUNIT_VERSION')) {
11-
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
10+
11+
if (!getenv('SYMFONY_PHPUNIT_VERSION')) {
12+
if (\PHP_VERSION_ID >= 70100) {
13+
// PHPUnit 7 requires PHP 7.1+
14+
putenv('SYMFONY_PHPUNIT_VERSION=7.4');
15+
} elseif (\PHP_VERSION_ID >= 70000) {
16+
// PHPUnit 6 requires PHP 7.0+
17+
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
18+
} elseif (\PHP_VERSION_ID >= 50600) {
19+
// PHPUnit 5 requires PHP 5.6+
20+
putenv('SYMFONY_PHPUNIT_VERSION=5.7');
21+
} else {
22+
// PHPUnit 4.8 requires PHP 5.3.3+
23+
putenv('SYMFONY_PHPUNIT_VERSION=4.8');
24+
}
1225
}
26+
1327
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
1428
require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,17 @@ $getEnvVar = function ($name, $default = false) {
4545
return $default;
4646
};
4747

48-
if (PHP_VERSION_ID >= 70200) {
49-
// PHPUnit 6 is required for PHP 7.2+
48+
if (PHP_VERSION_ID >= 70100) {
49+
// PHPUnit 7 requires PHP 7.1+
50+
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '7.4');
51+
} elseif (PHP_VERSION_ID >= 70000) {
52+
// PHPUnit 6 requires PHP 7.0+
5053
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '6.5');
5154
} elseif (PHP_VERSION_ID >= 50600) {
52-
// PHPUnit 4 does not support PHP 7
55+
// PHPUnit 5 requires PHP 5.6+
5356
$PHPUNIT_VERSION = $getEnvVar('SYMFONY_PHPUNIT_VERSION', '5.7');
5457
} else {
55-
// PHPUnit 5.1 requires PHP 5.6+
58+
// PHPUnit 4.8 requires PHP 5.3.3+
5659
$PHPUNIT_VERSION = '4.8';
5760
}
5861

0 commit comments

Comments
 (0)
0