Skip to content

When using custom-rule command, add rector test suite to PHPUnit config if one does not already exist #8486

@DaveLiddament

Description

@DaveLiddament

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.xml file exists.
  • there is NO rector test 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions