diff --git a/src/BrandEmbassyCodingStandard/PhpStan/Rules/Mockery/TestsExtendMockeryTestCaseRule/TestsExtendMockeryTestCaseRule.php b/src/BrandEmbassyCodingStandard/PhpStan/Rules/Mockery/TestsExtendMockeryTestCaseRule/TestsExtendMockeryTestCaseRule.php index 76276c1..acef136 100644 --- a/src/BrandEmbassyCodingStandard/PhpStan/Rules/Mockery/TestsExtendMockeryTestCaseRule/TestsExtendMockeryTestCaseRule.php +++ b/src/BrandEmbassyCodingStandard/PhpStan/Rules/Mockery/TestsExtendMockeryTestCaseRule/TestsExtendMockeryTestCaseRule.php @@ -40,7 +40,7 @@ public function getNodeType(): string */ public function processNode(Node $node, Scope $scope): array { - if ($node->name === null || $node->isAbstract()) { + if ($node->name === null) { return []; } diff --git a/src/BrandEmbassyCodingStandard/PhpStan/Rules/Mockery/TestsExtendMockeryTestCaseRule/TestsExtendMockeryTestCaseRuleTest.php b/src/BrandEmbassyCodingStandard/PhpStan/Rules/Mockery/TestsExtendMockeryTestCaseRule/TestsExtendMockeryTestCaseRuleTest.php index aba47d7..5b38f93 100644 --- a/src/BrandEmbassyCodingStandard/PhpStan/Rules/Mockery/TestsExtendMockeryTestCaseRule/TestsExtendMockeryTestCaseRuleTest.php +++ b/src/BrandEmbassyCodingStandard/PhpStan/Rules/Mockery/TestsExtendMockeryTestCaseRule/TestsExtendMockeryTestCaseRuleTest.php @@ -87,4 +87,27 @@ public function testExtendsSlevomatCodingStandardTestCase(): void [], ); } + + + public function testAbstractTestExtendsPhpUnitTestCase(): void + { + $this->analyse( + [__DIR__ . '/__fixtures__/AbstractTestExtendsPhpUnitTestCase.php'], + [ + [ + 'PHPUnit test BrandEmbassyCodingStandard\PhpStan\Rules\Mockery\TestsExtendMockeryTestCaseRule\__fixtures__\AbstractTestExtendsPhpUnitTestCase must extend Mockery\Adapter\Phpunit\MockeryTestCase (directly or indirectly).', + 7, + ], + ], + ); + } + + + public function testAbstractTestExtendsMockeryTestCase(): void + { + $this->analyse( + [__DIR__ . '/__fixtures__/AbstractTestExtendsMockeryTestCase.php'], + [], + ); + } } diff --git a/src/BrandEmbassyCodingStandard/PhpStan/Rules/Mockery/TestsExtendMockeryTestCaseRule/__fixtures__/AbstractTestExtendsMockeryTestCase.php b/src/BrandEmbassyCodingStandard/PhpStan/Rules/Mockery/TestsExtendMockeryTestCaseRule/__fixtures__/AbstractTestExtendsMockeryTestCase.php new file mode 100644 index 0000000..9f4715a --- /dev/null +++ b/src/BrandEmbassyCodingStandard/PhpStan/Rules/Mockery/TestsExtendMockeryTestCaseRule/__fixtures__/AbstractTestExtendsMockeryTestCase.php @@ -0,0 +1,9 @@ +