Skip to content

Commit 8ae4914

Browse files
kbondNyholm
andauthored
Symfony 7 support (#149)
* feat: Symfony 7 support * fixes... * cs --------- Co-authored-by: Nyholm <[email protected]>
1 parent 8b52e93 commit 8ae4914

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,21 @@ jobs:
1313
php:
1414
- '8.1'
1515
- '8.2'
16+
- '8.3'
1617
dependency:
1718
- ''
1819
symfony:
1920
- '5.4.*'
20-
- '6.2.*'
2121
- '6.3.*'
22+
- '6.4.*'
23+
- '7.0.*'
2224
include:
2325
- php: '8.1'
2426
symfony: '5.4.*'
2527
dependency: 'lowest'
28+
exclude:
29+
- php: '8.1'
30+
symfony: '7.0.*'
2631
fail-fast: false
2732
steps:
2833
- name: Checkout

Tests/Fixtures/SimpleConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class SimpleConfiguration implements ConfigurationInterface
99
{
10-
public function getConfigTreeBuilder()
10+
public function getConfigTreeBuilder(): TreeBuilder
1111
{
1212
$treeBuilder = new TreeBuilder('simple');
1313
$rootNode = $treeBuilder->getRootNode();

Tests/PhpUnit/ContainerHasParameterConstraintTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,37 @@ class ContainerHasParameterConstraintTest extends TestCase
1010
{
1111
/**
1212
* @test
13+
*
1314
* @dataProvider containerBuilderProvider
1415
*/
1516
public function match(
16-
ContainerInterface $container,
17+
array $containerParameters,
1718
$parameterName,
1819
$parameterValue,
1920
$checkParameterValue,
2021
$expectedToMatch
2122
): void {
23+
$container = $this->createMockContainerWithParameters($containerParameters);
2224
$constraint = new ContainerHasParameterConstraint($parameterName, $parameterValue, $checkParameterValue);
2325

2426
$this->assertSame($expectedToMatch, $constraint->evaluate($container, '', true));
2527
}
2628

27-
public function containerBuilderProvider()
29+
public static function containerBuilderProvider()
2830
{
29-
$emptyContainer = $this->createMockContainerWithParameters([]);
30-
3131
$parameterName = 'parameter_name';
3232
$parameterValue = 'some value';
3333
$wrongParameterValue = 'some other value';
3434

3535
return [
3636
// the container does not have the parameter
37-
[$emptyContainer, $parameterName, $parameterValue, true, false],
37+
[[], $parameterName, $parameterValue, true, false],
3838
// the container has the parameter but the values don't match
39-
[$this->createMockContainerWithParameters([$parameterName => $parameterValue]), $parameterName, $wrongParameterValue, true, false],
39+
[[$parameterName => $parameterValue], $parameterName, $wrongParameterValue, true, false],
4040
// the container has the parameter and the value matches
41-
[$this->createMockContainerWithParameters([$parameterName => $parameterValue]), $parameterName, $parameterValue, true, true],
41+
[[$parameterName => $parameterValue], $parameterName, $parameterValue, true, true],
4242
// the container has the parameter and the value is optional
43-
[$this->createMockContainerWithParameters([$parameterName => $parameterValue]), $parameterName, null, false, true],
43+
[[$parameterName => $parameterValue], $parameterName, null, false, true],
4444
];
4545
}
4646

@@ -49,14 +49,14 @@ private function createMockContainerWithParameters(array $parameters)
4949
$container = $this->createMock(ContainerInterface::class);
5050

5151
$container
52-
->expects($this->any())
52+
->expects(self::any())
5353
->method('hasParameter')
5454
->willReturnCallback(function ($parameterName) use ($parameters) {
5555
return array_key_exists($parameterName, $parameters);
5656
});
5757

5858
$container
59-
->expects($this->any())
59+
->expects(self::any())
6060
->method('getParameter')
6161
->willReturnCallback(function ($parameterName) use ($parameters) {
6262
return $parameters[$parameterName];

composer.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "matthiasnoback/symfony-dependency-injection-test",
33
"type": "library",
44
"description": "Library for testing user classes related to the Symfony Dependency Injection Component",
5-
"keywords": ["symfony2", "dependency injection", "phpunit"],
6-
"homepage": "http://github.com/matthiasnoback/SymfonyDependencyInjectionTest",
5+
"keywords": ["symfony2", "dependency injection", "phpunit", "dev"],
6+
"homepage": "https://github.com/matthiasnoback/SymfonyDependencyInjectionTest",
77
"license": "MIT",
88
"authors": [
99
{
@@ -15,9 +15,9 @@
1515
"require": {
1616
"php": "^8.1",
1717
"matthiasnoback/symfony-config-test": "^5.0",
18-
"symfony/dependency-injection": "^5.4 || ^6.2",
19-
"symfony/config": "^5.4 || ^6.2",
20-
"symfony/yaml": "^5.4 || ^6.2"
18+
"symfony/dependency-injection": "^5.4 || ^6.2 || ^7.0",
19+
"symfony/config": "^5.4 || ^6.2 || ^7.0",
20+
"symfony/yaml": "^5.4 || ^6.2 || ^7.0"
2121
},
2222
"require-dev": {
2323
"phpunit/phpunit": "^9.6 || ^10.0"
@@ -36,5 +36,7 @@
3636
"branch-alias": {
3737
"dev-master": "5.0.x-dev"
3838
}
39-
}
39+
},
40+
"minimum-stability": "dev",
41+
"prefer-stable": true
4042
}

0 commit comments

Comments
 (0)