4
4
5
5
namespace RoaveTest \BackwardCompatibility \Configuration ;
6
6
7
+ use PHPUnit \Framework \Attributes \After ;
8
+ use PHPUnit \Framework \Attributes \Before ;
9
+ use PHPUnit \Framework \Attributes \CoversClass ;
10
+ use PHPUnit \Framework \Attributes \DataProvider ;
7
11
use PHPUnit \Framework \TestCase ;
8
12
use Psl \Env ;
9
13
use Psl \File ;
14
18
use Roave \BackwardCompatibility \Configuration \InvalidConfigurationStructure ;
15
19
use Roave \BackwardCompatibility \Configuration \ParseXmlConfigurationFile ;
16
20
21
+ #[CoversClass(ParseXmlConfigurationFile::class)]
17
22
final class ParseXmlConfigurationFileTest extends TestCase
18
23
{
19
24
private string $ temporaryDirectory ;
20
25
21
- /** @before */
26
+ #[Before]
22
27
public function prepareFilesystem (): void
23
28
{
24
29
$ this ->temporaryDirectory = Filesystem \create_temporary_file (
@@ -33,25 +38,22 @@ public function prepareFilesystem(): void
33
38
Filesystem \create_directory ($ this ->temporaryDirectory );
34
39
}
35
40
36
- /** @after */
41
+ #[After]
37
42
public function cleanUpFilesystem (): void
38
43
{
39
44
Shell \execute ('rm ' , ['-rf ' , $ this ->temporaryDirectory ]);
40
45
}
41
46
42
- /** @test */
43
- public function defaultConfigurationShouldBeUsedWhenFileDoesNotExist (): void
47
+ public function testDefaultConfigurationShouldBeUsedWhenFileDoesNotExist (): void
44
48
{
45
49
$ config = (new ParseXmlConfigurationFile ())->parse ($ this ->temporaryDirectory );
46
50
47
51
self ::assertEquals (Configuration::default (), $ config );
48
52
}
49
53
50
- /**
51
- * @test
52
- * @dataProvider invalidConfiguration
53
- */
54
- public function exceptionShouldBeRaisedWhenStructureIsInvalid (
54
+ /** @dataProvider invalidConfiguration */
55
+ #[DataProvider('invalidConfiguration ' )]
56
+ public function testExceptionShouldBeRaisedWhenStructureIsInvalid (
55
57
string $ xmlContents ,
56
58
string $ expectedError ,
57
59
): void {
@@ -122,11 +124,9 @@ public static function invalidConfiguration(): iterable
122
124
];
123
125
}
124
126
125
- /**
126
- * @test
127
- * @dataProvider validConfiguration
128
- */
129
- public function baselineShouldBeParsed (
127
+ /** @dataProvider validConfiguration */
128
+ #[DataProvider('validConfiguration ' )]
129
+ public function testBaselineShouldBeParsed (
130
130
string $ xmlContents ,
131
131
Baseline $ expectedBaseline ,
132
132
): void {
0 commit comments