pestphp / drift

[WIP] Command-line tool to migrate your PHPUnit tests to Pest
https://pestphp.com/docs/guides/drift
MIT License
28 stars 7 forks source link

feat(polish): add Rectors for renaming functions #18

Closed owenvoke closed 4 years ago

owenvoke commented 4 years ago

This adds 2 new Rectors for the polish command to allow renaming test() calls.

Closes #8

owenvoke commented 4 years ago

Pushed some tests for these Rectors. 👍🏻

Tests are working when I filter them locally, however the full test suite isn't and on GitHub Actions it looks like there are warnings about Error: Class 'Symplify\EasyTesting\DataProvider\StaticFixtureFinder' not found for all tests. 🤔

Just updated to the latest dependencies, looks like that's because Rector includes that package as a dev dependency, rather than a normal dependency.


On a side note, when I install symplify/easy-testing locally the tests now run without that warning, but instead have the following error for all tests:

Pest\Drift\Testing\Rectors\Polish\FuncCall\PestTestNamingRectorTest::test with data set #0 (Symplify\SmartFileSystem\SmartFileInfo Object (...))
Rector\Core\Exception\ShouldNotHappenException: Class "" in "getRectorClass()" method must be type of "Rector\Core\Contract\Rector\PhpRectorInterface"

/Users/owenvoke/projects/pestphp/drift/vendor/rector/rector/src/Testing/PHPUnit/AbstractGenericRectorTestCase.php:145
/Users/owenvoke/projects/pestphp/drift/vendor/rector/rector/src/Testing/PHPUnit/AbstractGenericRectorTestCase.php:86
/Users/owenvoke/projects/pestphp/drift/vendor/rector/rector/src/Testing/PHPUnit/AbstractRectorTestCase.php:228
/Users/owenvoke/projects/pestphp/drift/vendor/rector/rector/src/Testing/PHPUnit/AbstractRectorTestCase.php:97
olivernybroe commented 4 years ago

One of the test are not implemented yet, so the test suite won't pass. That is on purpose, so we know this bug is there.

Looks like the error about that class started when we upgraded our rector version. Did not see that 😮

Can you add that dependency to our dev dependencies then and fix it?

olivernybroe commented 4 years ago

@owenvoke You can fix that error by implementing getRectorClass and adding the rector of the test class to it. That way the test class is only testing one rector which should be possible for us to do for all polish command rectors