-
-
Notifications
You must be signed in to change notification settings - Fork 737
Description
Question
I earlier asked another question here, but then that question morphed to something totally different so thought it best to create a new issue which is on topic. I am trying to gain a better understand how to perform https://github.com/rectorphp/rector/blob/main/docs/how_to_add_test_for_rector_rule.md, and have a few questions.
- Should Symfony be installed first (i.e.
new symfony my_project) - Should phpunit be installed first (i.e.
composer require --dev phpunit/phpunit ^9) - Is PhpStorm required? Note that I do not use it.
- Is there any other software (other than
composer require rector/rector --devof course) that needs to be installed? - Must content from rector-src be used? Reason I ask is it has
rules-tests/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector/Fixture. - When performing Step 3 Find the Rector Test Case, where are these directories and files located, and are they somehow automatically created by Rector (which they are not being done so for me) or do I manually add them? If I must manually add them, how do I know what content to include other than copying what is in rector-src?
- If PHPUnit fails and I've successfully added a test case, where do I find it so I can include with any bugs I might find?
I ended up copying rules-tests from rector-src to my project and then added add_final.php.inc to match the the script shown in step 4 Add Change or No-Change Test Fixture File. But when executing vendor/bin/phpunit rules-tests/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector/FinalizeClassesWithoutChildrenRectorTest.php, got some errors that /src/constants.php and /preload.php were missing so just copied them from rector-src, and then that Class Symfony\Bridge\PhpUnit\SymfonyTestsListener does not exist and concluded I am obviously doing something wrong :(
Appreciate any help and apologize if I should already know how to do this.