Skip to content

Add rector test suite to phpunit.xml or phpunit.xml.dist#5717

Merged
TomasVotruba merged 9 commits intorectorphp:mainfrom
ghostwriter:oss/rectorphp/rector/issue-8486
Mar 26, 2024
Merged

Add rector test suite to phpunit.xml or phpunit.xml.dist#5717
TomasVotruba merged 9 commits intorectorphp:mainfrom
ghostwriter:oss/rectorphp/rector/issue-8486

Conversation

@ghostwriter
Copy link
Copy Markdown
Contributor

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

Resolves rectorphp/rector#8486

Resolves rectorphp/rector#8486

Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@samsonasik
Copy link
Copy Markdown
Member

@ghostwriter could you fix phpstan notice at https://github.com/rectorphp/rector-src/actions/runs/8272661065/job/22634950125?pr=5717 ? create separate private method and call it and use assert or if check should solve it. Thank you.

Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
ghostwriter and others added 2 commits March 16, 2024 01:09
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>

Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@TomasVotruba TomasVotruba merged commit 83046fc into rectorphp:main Mar 26, 2024
@TomasVotruba
Copy link
Copy Markdown
Member

Thank you 👍

@ghostwriter ghostwriter deleted the oss/rectorphp/rector/issue-8486 branch March 26, 2024 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants