WordPress / WordPress/Requests
Tests: Streamline running of tests against all PHPUnit versions
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 500
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 5
Description
The PR #817 introduced a new configuration file for PHPUnit 10, separate from the previous configuration file. In order to run tests against PHPUnit 10, you now have to run composer test10 instead of only composer test.
It would be preferable to have only a singular entry point of composer test that is smart enough to run PHPUnit against the right configuration file.
While looking into this, we've found that PHPUnit has a very convenient flag --atleast-version <version> which could be used to run the tests conditionally. So, the idea is to have something like this (simplified):
"test": [
"phpunit --atleast-version 10 && phpunit -c phpunit10.xml.dist --no-coverage",
"phpunit --atleast-version 10 || phpunit --no-coverage"
],
That should generally work.
However, we have yet to find a way to combine this with the use of @php to reuse the exact PHP process that Composer is running under. According to the Composer documentation, you cannot combine multiple commands like this:
One limitation of this is that you can not call multiple commands in a row like @php install && @php foo. You must split them up in a JSON array of commands.
This is why PR #817 has separate Composer scripts at this point: composer test & composer test10.
This goes against Composer conventions and requires the user to know details about the test flow and dependencies in order to run the tests.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the Composer test scripts and the PHPUnit 10 configuration file phpunit10.xml.dist, then compare them with the existing PHPUnit configuration. Run composer test with the supported PHPUnit versions and confirm that one entry point selects the appropriate configuration without requiring composer test10.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- build-system, testing
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100