|
| 1 | +<?php declare(strict_types = 1); |
| 2 | + |
| 3 | +namespace PHPStan\Rules\PHPUnit; |
| 4 | + |
| 5 | +use PHPStan\Rules\Rule; |
| 6 | +use PHPStan\Testing\RuleTestCase; |
| 7 | + |
| 8 | +/** |
| 9 | + * @extends RuleTestCase<NoMissingSpaceInMethodAnnotationRule> |
| 10 | + */ |
| 11 | +class NoMissingSpaceInMethodAnnotationRuleTest extends RuleTestCase |
| 12 | +{ |
| 13 | + |
| 14 | + protected function getRule(): Rule |
| 15 | + { |
| 16 | + return new NoMissingSpaceInMethodAnnotationRule(new AnnotationHelper()); |
| 17 | + } |
| 18 | + |
| 19 | + public function testRule(): void |
| 20 | + { |
| 21 | + $this->analyse([__DIR__ . '/data/InvalidMethodCoversAnnotation.php'], [ |
| 22 | + [ |
| 23 | + 'Annotation "@backupGlobals" is invalid, "@backupGlobals" should be followed by a space and a value.', |
| 24 | + 12, |
| 25 | + ], |
| 26 | + [ |
| 27 | + 'Annotation "@backupStaticAttributes" is invalid, "@backupStaticAttributes" should be followed by a space and a value.', |
| 28 | + 19, |
| 29 | + ], |
| 30 | + [ |
| 31 | + 'Annotation "@covers\Dummy\Foo::assertSame" is invalid, "@covers" should be followed by a space and a value.', |
| 32 | + 27, |
| 33 | + ], |
| 34 | + [ |
| 35 | + 'Annotation "@covers::assertSame" is invalid, "@covers" should be followed by a space and a value.', |
| 36 | + 27, |
| 37 | + ], |
| 38 | + [ |
| 39 | + 'Annotation "@coversDefaultClass\Dummy\Foo" is invalid, "@coversDefaultClass" should be followed by a space and a value.', |
| 40 | + 33, |
| 41 | + ], |
| 42 | + [ |
| 43 | + 'Annotation "@dataProvider" is invalid, "@dataProvider" should be followed by a space and a value.', |
| 44 | + 39, |
| 45 | + ], |
| 46 | + [ |
| 47 | + 'Annotation "@depends" is invalid, "@depends" should be followed by a space and a value.', |
| 48 | + 45, |
| 49 | + ], |
| 50 | + [ |
| 51 | + 'Annotation "@preserveGlobalState" is invalid, "@preserveGlobalState" should be followed by a space and a value.', |
| 52 | + 52, |
| 53 | + ], |
| 54 | + [ |
| 55 | + 'Annotation "@requires" is invalid, "@requires" should be followed by a space and a value.', |
| 56 | + 58, |
| 57 | + ], |
| 58 | + [ |
| 59 | + 'Annotation "@testDox" is invalid, "@testDox" should be followed by a space and a value.', |
| 60 | + 64, |
| 61 | + ], |
| 62 | + [ |
| 63 | + 'Annotation "@testWith" is invalid, "@testWith" should be followed by a space and a value.', |
| 64 | + 70, |
| 65 | + ], |
| 66 | + [ |
| 67 | + 'Annotation "@ticket" is invalid, "@ticket" should be followed by a space and a value.', |
| 68 | + 76, |
| 69 | + ], |
| 70 | + [ |
| 71 | + 'Annotation "@uses" is invalid, "@uses" should be followed by a space and a value.', |
| 72 | + 82, |
| 73 | + ], |
| 74 | + ]); |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * @return string[] |
| 79 | + */ |
| 80 | + public static function getAdditionalConfigFiles(): array |
| 81 | + { |
| 82 | + return [ |
| 83 | + __DIR__ . '/../../../extension.neon', |
| 84 | + ]; |
| 85 | + } |
| 86 | + |
| 87 | +} |
0 commit comments