Skip to content

[PHPUnit60] Skip test methods in abstract classes in AddDoesNotPerformAssertionToNonAssertingTestRector - #828

Merged
TomasVotruba merged 2 commits into
mainfrom
tv-skip-abstract-class-tests
Nov 14, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
tv-skip-abstract-class-tests

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Part of rectorphp/rector#9965, split from #827.

A test method in an abstract class runs in every child class. A child can add an asserting setUp(), tearDown() or other lifecycle method, which PHPUnit counts toward the inherited test. #[DoesNotPerformAssertions] on the abstract method then makes the child's test fail with failOnRisky.

The rule cannot see all child classes, so it now skips test methods in abstract classes.

@TomasVotruba
TomasVotruba merged commit 745886e into main Nov 14, 2026
10 checks passed
@TomasVotruba
TomasVotruba deleted the tv-skip-abstract-class-tests branch November 14, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant