44namespace DR \CodeSnifferBaseline \Tests \Unit \Baseline ;
55
66use DR \CodeSnifferBaseline \Baseline \BaselineSetFactory ;
7+ use PHPUnit \Framework \Attributes \CoversClass ;
78use PHPUnit \Framework \TestCase ;
89use RuntimeException ;
910
10- /**
11- * @coversDefaultClass \DR\CodeSnifferBaseline\Baseline\BaselineSetFactory
12- */
11+ #[CoversClass(BaselineSetFactory::class)]
1312class BaselineSetFactoryTest extends TestCase
1413{
15- /**
16- * @covers ::fromFile
17- */
1814 public function testFromFileShouldSucceed (): void
1915 {
2016 $ filename = __DIR__ . '/TestFiles/baseline.xml ' ;
@@ -23,9 +19,6 @@ public function testFromFileShouldSucceed(): void
2319 static ::assertTrue ($ set ->contains ('Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen ' , '/test/src/foo/bar ' , 'foobar ' ));
2420 }
2521
26- /**
27- * @covers ::fromFile
28- */
2922 public function testFromFileShouldSucceedWithBackAndForwardSlashes (): void
3023 {
3124 $ filename = __DIR__ . '/TestFiles/baseline.xml ' ;
@@ -35,47 +28,32 @@ public function testFromFileShouldSucceedWithBackAndForwardSlashes(): void
3528 static ::assertTrue ($ set ->contains ('Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen ' , '/test \\src \\foo/bar ' , 'foobar ' ));
3629 }
3730
38- /**
39- * @covers ::fromFile
40- */
4131 public function testFromFileShouldReturnNullIfAbsent (): void
4232 {
4333 static ::assertNull (BaselineSetFactory::fromFile ('foobar.xml ' ));
4434 }
4535
46- /**
47- * @covers ::fromFile
48- */
4936 public function testFromFileShouldThrowExceptionForOnInvalidXML (): void
5037 {
5138 $ this ->expectException (RuntimeException::class);
5239 $ this ->expectExceptionMessage ('Unable to read xml from ' );
5340 BaselineSetFactory::fromFile (__DIR__ . '/TestFiles/invalid-baseline.xml ' );
5441 }
5542
56- /**
57- * @covers ::fromFile
58- */
5943 public function testFromFileViolationMissingSniffShouldThrowException (): void
6044 {
6145 $ this ->expectException (RuntimeException::class);
6246 $ this ->expectExceptionMessage ('Missing `sniff` attribute in `violation` ' );
6347 BaselineSetFactory::fromFile (__DIR__ . '/TestFiles/missing-sniff-baseline.xml ' );
6448 }
6549
66- /**
67- * @covers ::fromFile
68- */
6950 public function testFromFileViolationMissingSignatureShouldThrowException (): void
7051 {
7152 $ this ->expectException (RuntimeException::class);
7253 $ this ->expectExceptionMessage ('Missing `signature` attribute in `violation` in ' );
7354 BaselineSetFactory::fromFile (__DIR__ . '/TestFiles/missing-signature-baseline.xml ' );
7455 }
7556
76- /**
77- * @covers ::fromFile
78- */
7957 public function testFromFileViolationMissingFileShouldThrowException (): void
8058 {
8159 $ this ->expectException (RuntimeException::class);
0 commit comments