rectorphp / rector-phpunit

Rector upgrade rules for PHPUnit
https://getrector.com/find-rule?activeRectorSetGroup=phpunit
MIT License
68 stars 47 forks source link

Add failing test fixture for `StaticDataProviderClassMethodRector` with ignored abstract parent test case #160

Closed OskarStark closed 1 year ago

OskarStark commented 1 year ago

Failing Test for StaticDataProviderClassMethodRector

Based on https://getrector.com/demo/9372e294-4277-4bb9-abeb-34764c0b053c

Explanation

Because the parent abstract class is skipped in rector config, their child classes should be ignored for this rector as well. Check the demo link please, thanks.

This test should be failing ❗

Spotted in

TomasVotruba commented 1 year ago

This is identical to already fixed https://github.com/rectorphp/rector-phpunit/pull/156

How is it different?

OskarStark commented 1 year ago
CleanShot 2023-02-11 at 13 23 22@2x

I told rector to skip the abstract class, which cannot be reflected in the failing test case

TomasVotruba commented 1 year ago

I see. It only works for explicit paths, no magic :)

Also, the __DIR__ . 'String might result into SomePathString

TomasVotruba commented 1 year ago

Btw, what is reason to ignore any files here? The upgrade must handle all files.

OskarStark commented 1 year ago

In Symfony all abstract cases in /Test/ namespace are under BC promise and can be used in username. All abstract testcases in /Tests/ namespace are considered internal and are only used for our codebase, which we can change but the ones in /Test/ need to have an upgrade path including deprecations we need to find manually.

But ofc our own tests in /Test/ are using the abstract testcases from /Test/

I hope I make it clear 😃 thanks for your time

TomasVotruba commented 1 year ago

I see :) That's super specific use case that would be only useful for Symfony core project.

I think for that would be best just to fork Rector rule to custom one and apply this logic there.