Skip to content

Commit 8e8a690

Browse files
authored
phpunit 12 (#88)
- add support for phpunit 12 - remove phpunit <10.5 support - update readme with new version guidance
1 parent 7380c74 commit 8e8a690

10 files changed

+70
-147
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,11 @@ public function processed_configuration_for_array_node_1(): void
268268

269269
## Version Guidance
270270

271-
| Version | Released | PHPUnit | Status |
272-
|---------|--------------| ----------------------|------------|
273-
| 5.x | Jun 2, 2023 | 9.6 and 10.x and 11.x | Latest |
274-
| 4.x | Mar 5, 2018 | 7.x and 8.x and 9.x | Bugfixes |
275-
| 3.x | Nov 30, 2017 | 6.x   | EOL |
276-
| 2.x | Jun 18, 2016 | 4.x and 5.x | EOL |
277-
| 1.x | Oct 12, 2014 | 3.x | EOL |
271+
| Version | Released | PHPUnit | Status |
272+
|---------|--------------|------------------------|----------|
273+
| 6.x | Feb 7, 2025 | 10.5 and 11.x and 12.x | Latest |
274+
| 5.x | Jun 2, 2023 | 9.6 and 10.x and 11.x | Bugfixes |
275+
| 4.x | Mar 5, 2018 | 7.x and 8.x and 9.x | EOL |
276+
| 3.x | Nov 30, 2017 | 6.x | EOL |
277+
| 2.x | Jun 18, 2016 | 4.x and 5.x | EOL |
278+
| 1.x | Oct 12, 2014 | 3.x | EOL |

Tests/Partial/PartialNodeTest.php

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
use Matthias\SymfonyConfigTest\Partial\Exception\ChildIsNotAnArrayNode;
66
use Matthias\SymfonyConfigTest\Partial\Exception\UndefinedChildNode;
77
use Matthias\SymfonyConfigTest\Partial\PartialNode;
8+
use PHPUnit\Framework\Attributes\Test;
89
use PHPUnit\Framework\TestCase;
910
use Symfony\Component\Config\Definition\ArrayNode;
1011
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1112
use Symfony\Component\Config\Definition\PrototypedArrayNode;
1213

1314
class PartialNodeTest extends TestCase
1415
{
15-
/**
16-
* @test
17-
*/
16+
#[Test]
1817
public function it_strips_children_that_are_not_in_the_given_path_with_one_name()
1918
{
2019
$treeBuilder = new TreeBuilder('root');
@@ -39,9 +38,7 @@ public function it_strips_children_that_are_not_in_the_given_path_with_one_name(
3938
$this->nodeOnlyHasChild($node, 'node_2');
4039
}
4140

42-
/**
43-
* @test
44-
*/
41+
#[Test]
4542
public function it_strips_children_that_are_not_in_the_given_path_with_several_names()
4643
{
4744
$treeBuilder = new TreeBuilder('root');
@@ -77,9 +74,7 @@ public function it_strips_children_that_are_not_in_the_given_path_with_several_n
7774
$this->nodeOnlyHasChild($node1, 'node_1_b');
7875
}
7976

80-
/**
81-
* @test
82-
*/
77+
#[Test]
8378
public function it_strips_children_when_leaf_node_is_not_an_array()
8479
{
8580
$treeBuilder = new TreeBuilder('root');
@@ -104,9 +99,7 @@ public function it_strips_children_when_leaf_node_is_not_an_array()
10499
$this->nodeOnlyHasChild($node, 'node_3');
105100
}
106101

107-
/**
108-
* @test
109-
*/
102+
#[Test]
110103
public function it_does_not_crash_on_prototypes()
111104
{
112105
$treeBuilder = new TreeBuilder('root');
@@ -134,9 +127,7 @@ public function it_does_not_crash_on_prototypes()
134127
$this->nodeOnlyHasChild($prototypeNode, 'node_1');
135128
}
136129

137-
/**
138-
* @test
139-
*/
130+
#[Test]
140131
public function it_fails_when_a_requested_child_node_does_not_exist()
141132
{
142133
$treeBuilder = new TreeBuilder('root');
@@ -155,9 +146,7 @@ public function it_fails_when_a_requested_child_node_does_not_exist()
155146
PartialNode::excludeEverythingNotInPath($node, ['sub_node', 'non_existing_node']);
156147
}
157148

158-
/**
159-
* @test
160-
*/
149+
#[Test]
161150
public function it_fails_when_a_requested_child_node_is_no_array_node_itself_and_path_not_empty()
162151
{
163152
$treeBuilder = new TreeBuilder('root');

Tests/Partial/PartialProcessorTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44

55
use Matthias\SymfonyConfigTest\Partial\PartialProcessor;
66
use Matthias\SymfonyConfigTest\Tests\Partial\Fixtures\ConfigurationStub;
7+
use PHPUnit\Framework\Attributes\Test;
78
use PHPUnit\Framework\TestCase;
89
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
910

1011
class PartialProcessorTest extends TestCase
1112
{
12-
/**
13-
* @test
14-
*/
13+
#[Test]
1514
public function it_processes_only_the_values_in_the_breadcrumb_path_for_a_given_node()
1615
{
1716
$treeBuilder = new TreeBuilder('root');
@@ -56,9 +55,7 @@ public function it_processes_only_the_values_in_the_breadcrumb_path_for_a_given_
5655
);
5756
}
5857

59-
/**
60-
* @test
61-
*/
58+
#[Test]
6259
public function it_processes_only_the_values_in_the_given_breadcrumb_path_for_a_given_configuration_instance()
6360
{
6461
$partialProcessor = new PartialProcessor();

Tests/PhpUnit/ConfigurationTestCaseTraitTest.php

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
66
use Matthias\SymfonyConfigTest\Tests\PhpUnit\Fixtures\ConfigurationWithRequiredValue;
7+
use PHPUnit\Framework\Attributes\Test;
78
use PHPUnit\Framework\ExpectationFailedException;
89
use PHPUnit\Framework\TestCase;
910

@@ -16,9 +17,7 @@ protected function getConfiguration()
1617
return new ConfigurationWithRequiredValue();
1718
}
1819

19-
/**
20-
* @test
21-
*/
20+
#[Test]
2221
public function it_can_assert_that_a_configuration_is_invalid()
2322
{
2423
$this->assertConfigurationIsInvalid(
@@ -29,9 +28,7 @@ public function it_can_assert_that_a_configuration_is_invalid()
2928
);
3029
}
3130

32-
/**
33-
* @test
34-
*/
31+
#[Test]
3532
public function it_fails_when_a_configuration_is_valid_when_it_should_have_been_invalid()
3633
{
3734
$this->expectException(ExpectationFailedException::class);
@@ -44,9 +41,7 @@ public function it_fails_when_a_configuration_is_valid_when_it_should_have_been_
4441
);
4542
}
4643

47-
/**
48-
* @test
49-
*/
44+
#[Test]
5045
public function it_can_assert_that_a_configuration_is_valid()
5146
{
5247
$this->assertConfigurationIsValid(
@@ -56,9 +51,7 @@ public function it_can_assert_that_a_configuration_is_valid()
5651
);
5752
}
5853

59-
/**
60-
* @test
61-
*/
54+
#[Test]
6255
public function it_fails_when_a_configuration_is_invalid_when_it_should_have_been_valid()
6356
{
6457
$this->expectException(ExpectationFailedException::class);
@@ -72,9 +65,7 @@ public function it_fails_when_a_configuration_is_invalid_when_it_should_have_bee
7265
);
7366
}
7467

75-
/**
76-
* @test
77-
*/
68+
#[Test]
7869
public function it_can_assert_that_a_processed_configuration_matches_the_expected_array_of_values()
7970
{
8071
$value = 'some value';
@@ -90,9 +81,7 @@ public function it_can_assert_that_a_processed_configuration_matches_the_expecte
9081
);
9182
}
9283

93-
/**
94-
* @test
95-
*/
84+
#[Test]
9685
public function it_fails_when_a_processed_configuration_does_not_match_the_expected_array_of_values()
9786
{
9887
$value = 'some value';
@@ -110,9 +99,7 @@ public function it_fails_when_a_processed_configuration_does_not_match_the_expec
11099
);
111100
}
112101

113-
/**
114-
* @test
115-
*/
102+
#[Test]
116103
public function it_throws_a_comparison_failed_exception_with_the_values_in_the_right_order()
117104
{
118105
$value = 'some value';

Tests/PhpUnit/ConfigurationValuesAreInvalidConstraintTest.php

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationValuesAreInvalidConstraint;
66
use Matthias\SymfonyConfigTest\Tests\PhpUnit\Fixtures\AlwaysValidConfiguration;
77
use Matthias\SymfonyConfigTest\Tests\PhpUnit\Fixtures\ConfigurationWithRequiredValue;
8+
use PHPUnit\Framework\Attributes\Test;
89
use PHPUnit\Framework\TestCase;
910

1011
class ConfigurationValuesAreInvalidConstraintTest extends TestCase
1112
{
12-
/**
13-
* @test
14-
*/
13+
#[Test]
1514
public function if_configuration_values_is_no_array_it_fails()
1615
{
1716
$constraint = new ConfigurationValuesAreInvalidConstraint(new AlwaysValidConfiguration());
@@ -22,9 +21,7 @@ public function if_configuration_values_is_no_array_it_fails()
2221
$constraint->evaluate('not an array');
2322
}
2423

25-
/**
26-
* @test
27-
*/
24+
#[Test]
2825
public function if_configuration_values_is_no_array_of_arrays_it_fails()
2926
{
3027
$constraint = new ConfigurationValuesAreInvalidConstraint(new AlwaysValidConfiguration());
@@ -35,29 +32,23 @@ public function if_configuration_values_is_no_array_of_arrays_it_fails()
3532
$constraint->evaluate(['not an array']);
3633
}
3734

38-
/**
39-
* @test
40-
*/
35+
#[Test]
4136
public function if_configuration_values_are_valid_it_does_not_match()
4237
{
4338
$constraint = new ConfigurationValuesAreInvalidConstraint(new AlwaysValidConfiguration());
4439

4540
$this->assertFalse($constraint->evaluate([[]], '', true));
4641
}
4742

48-
/**
49-
* @test
50-
*/
43+
#[Test]
5144
public function if_configuration_values_are_invalid_it_matches()
5245
{
5346
$constraint = new ConfigurationValuesAreInvalidConstraint(new ConfigurationWithRequiredValue());
5447

5548
$this->assertTrue($constraint->evaluate([[]], '', true));
5649
}
5750

58-
/**
59-
* @test
60-
*/
51+
#[Test]
6152
public function if_configuration_values_are_invalid_it_does_not_match_when_exception_message_is_not_right()
6253
{
6354
$constraint = new ConfigurationValuesAreInvalidConstraint(
@@ -68,9 +59,7 @@ public function if_configuration_values_are_invalid_it_does_not_match_when_excep
6859
$this->assertFalse($constraint->evaluate([[]], '', true));
6960
}
7061

71-
/**
72-
* @test
73-
*/
62+
#[Test]
7463
public function if_configuration_values_are_invalid_it_matches_when_exception_message_is_right()
7564
{
7665
$constraint = new ConfigurationValuesAreInvalidConstraint(
@@ -81,9 +70,7 @@ public function if_configuration_values_are_invalid_it_matches_when_exception_me
8170
$this->assertTrue($constraint->evaluate([[]], '', true));
8271
}
8372

84-
/**
85-
* @test
86-
*/
73+
#[Test]
8774
public function if_configuration_values_are_invalid_it_matches_when_exception_message_is_right_according_to_regexp()
8875
{
8976
$constraint = new ConfigurationValuesAreInvalidConstraint(
@@ -95,9 +82,7 @@ public function if_configuration_values_are_invalid_it_matches_when_exception_me
9582
$this->assertTrue($constraint->evaluate([[]], '', true));
9683
}
9784

98-
/**
99-
* @test
100-
*/
85+
#[Test]
10186
public function to_string_returns_a_message()
10287
{
10388
$constraint = new ConfigurationValuesAreInvalidConstraint(
@@ -107,9 +92,7 @@ public function to_string_returns_a_message()
10792
$this->assertSame('is invalid for the given configuration', $constraint->toString());
10893
}
10994

110-
/**
111-
* @test
112-
*/
95+
#[Test]
11396
public function to_string_also_mentions_the_expected_exception_message()
11497
{
11598
$expectedMessage = 'the expected message';

Tests/PhpUnit/ConfigurationValuesAreValidConstraintTest.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationValuesAreValidConstraint;
66
use Matthias\SymfonyConfigTest\Tests\PhpUnit\Fixtures\AlwaysValidConfiguration;
77
use Matthias\SymfonyConfigTest\Tests\PhpUnit\Fixtures\ConfigurationWithRequiredValue;
8+
use PHPUnit\Framework\Attributes\Test;
89
use PHPUnit\Framework\TestCase;
910

1011
class ConfigurationValuesAreValidConstraintTest extends TestCase
1112
{
12-
/**
13-
* @test
14-
*/
13+
#[Test]
1514
public function if_configuration_values_is_no_array_it_fails()
1615
{
1716
$constraint = new ConfigurationValuesAreValidConstraint(new AlwaysValidConfiguration());
@@ -22,9 +21,7 @@ public function if_configuration_values_is_no_array_it_fails()
2221
$constraint->evaluate('not an array');
2322
}
2423

25-
/**
26-
* @test
27-
*/
24+
#[Test]
2825
public function if_configuration_values_is_no_array_of_arrays_it_fails()
2926
{
3027
$constraint = new ConfigurationValuesAreValidConstraint(new AlwaysValidConfiguration());
@@ -35,29 +32,23 @@ public function if_configuration_values_is_no_array_of_arrays_it_fails()
3532
$constraint->evaluate(['not an array']);
3633
}
3734

38-
/**
39-
* @test
40-
*/
35+
#[Test]
4136
public function if_configuration_values_are_valid_it_matches()
4237
{
4338
$constraint = new ConfigurationValuesAreValidConstraint(new AlwaysValidConfiguration());
4439

4540
$this->assertTrue($constraint->evaluate([[]], '', true));
4641
}
4742

48-
/**
49-
* @test
50-
*/
43+
#[Test]
5144
public function if_configuration_values_are_invalid_it_does_not_match()
5245
{
5346
$constraint = new ConfigurationValuesAreValidConstraint(new ConfigurationWithRequiredValue());
5447

5548
$this->assertFalse($constraint->evaluate([[]], '', true));
5649
}
5750

58-
/**
59-
* @test
60-
*/
51+
#[Test]
6152
public function to_string_returns_a_message()
6253
{
6354
$constraint = new ConfigurationValuesAreValidConstraint(new AlwaysValidConfiguration());

0 commit comments

Comments
 (0)