When using `custom-rule` command, add rector test suite to PHPUnit config if one does not already exist
Feature Request
Thanks for a great tool. I love the custom-rule command.
It would be even better if this command setup phpunit.xml, in the same way composer.json is updated.
If all the following are true:
-
phpunit.xmlfile exists. - there is NO
rectortest suite
Then Rector adds the rector testsuite to phpunit.xml. The phpunit.xml diff would look a bit like this:
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
+ <testsuite name="rector">
+ <directory>utils/rector/tests</directory>
+ </testsuite>
<testsuites>
Rector would report is has done this, in a similar way to it reports updating composer.json. E.g.
[OK] We also update phpunit.xml, to add a rector test suite. You can run the rector tests by running: phpunit --testsuite rector
Hey Dave! Glad you find it useful :+1: Sounds reasonable... I actually do the same step manually myself.
Care to send PR to add this feature? :pray:
The composer.json update happens here - https://github.com/rectorphp/rector-src/blob/d62be327173447695dea93ff52d67d087d9fb9d4/src/Console/Command/CustomRuleCommand.php#L109-L127
So it would require adding similar condition for phpunit.xml