Skip to content

Commit 969080c

Browse files
emodricNyholm
authored andcommitted
Add support for PHPUnit 8 (#109)
* Add support for PHPUnit 8 * Reduce differences with a generated config file (#1) * Bump matthiasnoback/symfony-config-test to 4.0.1 * Add branch alias to composer.json
1 parent 83e4777 commit 969080c

20 files changed

+56
-62
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/phpunit.xml
22
/vendor
33
/composer.lock
4+
/.phpunit.result.cache

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@ matrix:
1111
fast_finish: true
1212
include:
1313
# Minimum supported Symfony version with the latest PHP version
14-
- php: 7.2
14+
- php: 7.3
1515
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
1616

1717
# Test the latest stable release
18-
- php: 7.1
1918
- php: 7.2
19+
- php: 7.3
2020
env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"
2121

2222
# Force some major versions of Symfony
23-
- php: 7.2
23+
- php: 7.3
2424
env: DEPENDENCIES="dunglas/symfony-lock:^2"
25-
- php: 7.2
25+
- php: 7.3
2626
env: DEPENDENCIES="dunglas/symfony-lock:^3"
27-
- php: 7.2
27+
- php: 7.3
2828
env: DEPENDENCIES="dunglas/symfony-lock:^4"
2929

3030
# Latest commit to master
31-
- php: 7.2
31+
- php: 7.3
3232
env: STABILITY="dev"
3333

3434
allow_failures:

PhpUnit/AbstractCompilerPassTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function compilation_should_not_fail_with_empty_container()
3131
}
3232
}
3333

34-
protected function setUp()
34+
protected function setUp(): void
3535
{
3636
parent::setUp();
3737

PhpUnit/AbstractContainerBuilderTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ abstract class AbstractContainerBuilderTestCase extends TestCase
1515
*/
1616
protected $container;
1717

18-
protected function setUp()
18+
protected function setUp(): void
1919
{
2020
$this->container = new ContainerBuilder();
2121
$this->container->getCompilerPassConfig()->setOptimizationPasses([]);
2222
$this->container->getCompilerPassConfig()->setRemovingPasses([]);
2323
}
2424

25-
protected function tearDown()
25+
protected function tearDown(): void
2626
{
2727
$this->container = null;
2828
}

PhpUnit/AbstractExtensionTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function getMinimalConfiguration()
3232
*
3333
* @see AbstractExtensionTestCase::tearDown()
3434
*/
35-
protected function setUp()
35+
protected function setUp(): void
3636
{
3737
parent::setUp();
3838

PhpUnit/ContainerBuilderHasAliasConstraint.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ class ContainerBuilderHasAliasConstraint extends Constraint
1313

1414
public function __construct($aliasId, $expectedServiceId = null)
1515
{
16-
parent::__construct();
17-
1816
if (!is_string($aliasId)) {
1917
throw new \InvalidArgumentException('The $aliasId argument should be a string');
2018
}

PhpUnit/ContainerBuilderHasServiceDefinitionConstraint.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ class ContainerBuilderHasServiceDefinitionConstraint extends Constraint
1414

1515
public function __construct($serviceId, $expectedClass = null, $checkExpectedClass = true)
1616
{
17-
parent::__construct();
18-
1917
if (!is_string($serviceId)) {
2018
throw new \InvalidArgumentException('The $serviceId argument should be a string');
2119
}
@@ -92,8 +90,8 @@ private function evaluateClass(ContainerBuilder $containerBuilder, $returnResult
9290
$this->fail($containerBuilder, sprintf(
9391
'The class of the service definition of "%s" (%s) does not match the expected value (%s)',
9492
$this->serviceId,
95-
$this->exporter->export($actualClass),
96-
$this->exporter->export($this->expectedClass)
93+
$this->exporter()->export($actualClass),
94+
$this->exporter()->export($this->expectedClass)
9795
));
9896
}
9997

PhpUnit/ContainerBuilderHasSyntheticServiceConstraint.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ class ContainerBuilderHasSyntheticServiceConstraint extends Constraint
1111

1212
public function __construct($serviceId)
1313
{
14-
parent::__construct();
15-
1614
if (!is_string($serviceId)) {
1715
throw new \InvalidArgumentException('The $serviceId argument should be a string');
1816
}

PhpUnit/ContainerHasParameterConstraint.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ class ContainerHasParameterConstraint extends Constraint
1414

1515
public function __construct($parameterName, $expectedParameterValue = null, $checkParameterValue = false)
1616
{
17-
parent::__construct();
18-
1917
$this->parameterName = $parameterName;
2018
$this->expectedParameterValue = $expectedParameterValue;
2119
$this->checkParameterValue = $checkParameterValue;
@@ -78,8 +76,8 @@ private function evaluateParameterValue(ContainerInterface $container, $returnRe
7876
$this->fail($container, sprintf(
7977
'The value of parameter "%s" (%s) does not match the expected value (%s)',
8078
$this->parameterName,
81-
$this->exporter->export($actualValue),
82-
$this->exporter->export($this->expectedParameterValue)
79+
$this->exporter()->export($actualValue),
80+
$this->exporter()->export($this->expectedParameterValue)
8381
));
8482
}
8583

PhpUnit/DefinitionArgumentEqualsServiceLocatorConstraint.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ class DefinitionArgumentEqualsServiceLocatorConstraint extends Constraint
2222

2323
public function __construct($serviceId, $argumentIndex, array $expectedValue)
2424
{
25-
parent::__construct();
26-
2725
if (!(is_string($argumentIndex) || (is_int($argumentIndex) && $argumentIndex >= 0))) {
2826
throw new \InvalidArgumentException('Expected either a string or a positive integer for $argumentIndex.');
2927
}
@@ -135,7 +133,7 @@ private function evaluateArgumentValue(ContainerBuilder $container, $returnResul
135133
sprintf(
136134
'The value of argument with index %s (%s) was expected to an instance of Symfony\Component\DependencyInjection\Reference or \Symfony\Component\DependencyInjection\Definition',
137135
$this->argumentIndex,
138-
$this->exporter->export($actualValue)
136+
$this->exporter()->export($actualValue)
139137
)
140138
);
141139
}
@@ -150,7 +148,7 @@ private function evaluateArgumentValue(ContainerBuilder $container, $returnResul
150148
sprintf(
151149
'The referenced service class of argument with index %s (%s) was expected to be an instance of Symfony\Component\DependencyInjection\ServiceLocator',
152150
$this->argumentIndex,
153-
$this->exporter->export($serviceLocatorDef->getClass())
151+
$this->exporter()->export($serviceLocatorDef->getClass())
154152
)
155153
);
156154
}
@@ -178,8 +176,8 @@ private function evaluateServiceDefinition(Definition $serviceLocatorDef, Defini
178176
sprintf(
179177
'The value of argument with index %s (%s) does not equal to the expected ServiceLocator service-map (%s)',
180178
$this->argumentIndex,
181-
$this->exporter->export($actualValue),
182-
$this->exporter->export($this->expectedValue)
179+
$this->exporter()->export($actualValue),
180+
$this->exporter()->export($this->expectedValue)
183181
)
184182
);
185183
}

0 commit comments

Comments
 (0)