Skip to content

[CodeQuality] Skip DecorateWillReturnMapWithExpectsMockRector on non-test methods#701

Merged
TomasVotruba merged 1 commit into
mainfrom
skip-non-test-methods-will-return-map
Jun 30, 2026
Merged

[CodeQuality] Skip DecorateWillReturnMapWithExpectsMockRector on non-test methods#701
TomasVotruba merged 1 commit into
mainfrom
skip-non-test-methods-will-return-map

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Improves DecorateWillReturnMapWithExpectsMockRector to only decorate willReturnMap() calls inside setUp() and actual test methods.

Previously it ran in any method except setUp(). Now it skips private helpers and protected/non-test methods (e.g. prepareSomeMock(), createSomeMock()), where the expects() count is not meaningful.

  • Switched node type to ClassMethod to reuse TestsNodeAnalyzer::isTestClassMethod() (handles test prefix, #[Test] attribute, @test annotation).
  • Added skip fixtures for private helper and protected non-test method.

@TomasVotruba TomasVotruba merged commit 41cf82b into main Jun 30, 2026
8 checks passed
@TomasVotruba TomasVotruba deleted the skip-non-test-methods-will-return-map branch June 30, 2026 12:01
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