Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e5c7c6b

Browse filesBrowse files
committed
[PhpUnitBridge] install PHPUnit 7 on PHP 7.1 and fix requirement for PHPUnit 6
1 parent c7fe1b6 commit e5c7c6b
Copy full SHA for e5c7c6b

File tree

7 files changed

+32
-13
lines changed
Filter options

7 files changed

+32
-13
lines changed

‎phpunit

Copy file name to clipboardExpand all lines: phpunit
+16-2Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
+7-4Lines 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

‎src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class DateTimeToHtml5LocalDateTimeTransformerTest extends TestCase
1818
{
19-
public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
19+
public static function assertEquals($expected, $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void
2020
{
2121
if ($expected instanceof \DateTime && $actual instanceof \DateTime) {
2222
$expected = $expected->format('c');

‎src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function tearDown()
3939
$this->dateTimeWithoutSeconds = null;
4040
}
4141

42-
public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
42+
public static function assertEquals($expected, $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void
4343
{
4444
if ($expected instanceof \DateTime && $actual instanceof \DateTime) {
4545
$expected = $expected->format('c');

‎src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function tearDown()
3333
$this->dateTimeWithoutSeconds = null;
3434
}
3535

36-
public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
36+
public static function assertEquals($expected, $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void
3737
{
3838
if ($expected instanceof \DateTime && $actual instanceof \DateTime) {
3939
$expected = $expected->format('c');

‎src/Symfony/Component/Validator/Tests/DataCollector/ValidatorDataCollectorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/DataCollector/ValidatorDataCollectorTest.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Validator\Tests\DataCollector;
1313

14+
use PHPUnit\Framework\MockObject\MockObject;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\Validator\ConstraintViolation;
1617
use Symfony\Component\Validator\ConstraintViolationList;
@@ -72,8 +73,8 @@ public function testReset()
7273
$this->assertSame(0, $collector->getViolationsCount());
7374
}
7475

75-
protected function createMock($classname)
76+
protected function createMock($originalClassName): MockObject
7677
{
77-
return $this->getMockBuilder($classname)->disableOriginalConstructor()->getMock();
78+
return $this->getMockBuilder($originalClassName)->disableOriginalConstructor()->getMock();
7879
}
7980
}

‎src/Symfony/Component/Validator/Tests/Validator/TraceableValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Validator/TraceableValidatorTest.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Validator\Tests\Validator;
1313

14+
use PHPUnit\Framework\MockObject\MockObject;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\Validator\Constraint;
1617
use Symfony\Component\Validator\ConstraintViolation;
@@ -97,8 +98,8 @@ public function testForwardsToOriginalValidator()
9798
$this->assertSame($expected, $validator->validatePropertyValue(new \stdClass(), 'property', 'value'), 'returns original validator validatePropertyValue() result');
9899
}
99100

100-
protected function createMock($classname)
101+
protected function createMock($originalClassName): MockObject
101102
{
102-
return $this->getMockBuilder($classname)->disableOriginalConstructor()->getMock();
103+
return $this->getMockBuilder($originalClassName)->disableOriginalConstructor()->getMock();
103104
}
104105
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.