4
4
namespace DR \CodeSnifferBaseline \Tests \Unit \Baseline ;
5
5
6
6
use DR \CodeSnifferBaseline \Baseline \BaselineSetFactory ;
7
+ use PHPUnit \Framework \Attributes \CoversClass ;
7
8
use PHPUnit \Framework \TestCase ;
8
9
use RuntimeException ;
9
10
10
- /**
11
- * @coversDefaultClass \DR\CodeSnifferBaseline\Baseline\BaselineSetFactory
12
- */
11
+ #[CoversClass(BaselineSetFactory::class)]
13
12
class BaselineSetFactoryTest extends TestCase
14
13
{
15
- /**
16
- * @covers ::fromFile
17
- */
18
14
public function testFromFileShouldSucceed (): void
19
15
{
20
16
$ filename = __DIR__ . '/TestFiles/baseline.xml ' ;
@@ -23,9 +19,6 @@ public function testFromFileShouldSucceed(): void
23
19
static ::assertTrue ($ set ->contains ('Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen ' , '/test/src/foo/bar ' , 'foobar ' ));
24
20
}
25
21
26
- /**
27
- * @covers ::fromFile
28
- */
29
22
public function testFromFileShouldSucceedWithBackAndForwardSlashes (): void
30
23
{
31
24
$ filename = __DIR__ . '/TestFiles/baseline.xml ' ;
@@ -35,47 +28,32 @@ public function testFromFileShouldSucceedWithBackAndForwardSlashes(): void
35
28
static ::assertTrue ($ set ->contains ('Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen ' , '/test \\src \\foo/bar ' , 'foobar ' ));
36
29
}
37
30
38
- /**
39
- * @covers ::fromFile
40
- */
41
31
public function testFromFileShouldReturnNullIfAbsent (): void
42
32
{
43
33
static ::assertNull (BaselineSetFactory::fromFile ('foobar.xml ' ));
44
34
}
45
35
46
- /**
47
- * @covers ::fromFile
48
- */
49
36
public function testFromFileShouldThrowExceptionForOnInvalidXML (): void
50
37
{
51
38
$ this ->expectException (RuntimeException::class);
52
39
$ this ->expectExceptionMessage ('Unable to read xml from ' );
53
40
BaselineSetFactory::fromFile (__DIR__ . '/TestFiles/invalid-baseline.xml ' );
54
41
}
55
42
56
- /**
57
- * @covers ::fromFile
58
- */
59
43
public function testFromFileViolationMissingSniffShouldThrowException (): void
60
44
{
61
45
$ this ->expectException (RuntimeException::class);
62
46
$ this ->expectExceptionMessage ('Missing `sniff` attribute in `violation` ' );
63
47
BaselineSetFactory::fromFile (__DIR__ . '/TestFiles/missing-sniff-baseline.xml ' );
64
48
}
65
49
66
- /**
67
- * @covers ::fromFile
68
- */
69
50
public function testFromFileViolationMissingSignatureShouldThrowException (): void
70
51
{
71
52
$ this ->expectException (RuntimeException::class);
72
53
$ this ->expectExceptionMessage ('Missing `signature` attribute in `violation` in ' );
73
54
BaselineSetFactory::fromFile (__DIR__ . '/TestFiles/missing-signature-baseline.xml ' );
74
55
}
75
56
76
- /**
77
- * @covers ::fromFile
78
- */
79
57
public function testFromFileViolationMissingFileShouldThrowException (): void
80
58
{
81
59
$ this ->expectException (RuntimeException::class);
0 commit comments