-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test suite running only partially since PHPUnit 9.1.3 (?) when PHPUnit called with file name to test suite setup file #4460
Comments
Let me stop you right there: The " |
Done. |
Glad to hear it as I personally found it quite unintuitive to work with.
👍 More than anything, I opened the issue to allow for other people searching for a solution to find one. |
This was during the PHPUnit 3 days, before we had a proper changelog. Sorry. |
@sebastianbergmann Ok, that happens. Thanks for responding. |
Summary
This is a bit of an awkward one to explain, so please bear with me. I will also include a solution which solved the issue for us.
With that in mind, feel free to close this issue if you deem this an acceptable BC-break, but I figured it would be helpful to document the issue anyway in case other people run into the same thing.
TL;DR: Calling PHPUnit with a file name pointing to a file which sets up a test suite, doesn't run the complete test suite anymore, but only part of it.
I suspect the issue is a regression related to issue #4232
Current behavior
Given the following config:
Where the
tests/AllTests.php
file contains a TestSuite setup along the following lines:And running PHPUnit with the following command:
Only 368 tests are run instead of the expected 567 tests.
Basically, the tests added via
$suite->addTest(Core\AllTests::suite());
are run and those added via$suite->addTest(Standards\AllSniffs::suite());
are not, or rather are not even added.(and please don't look at me for how the rest of the test suite is set up... not my code .. legacy project ... etc etc)
How to reproduce
git clone [email protected]:squizlabs/PHP_CodeSniffer.git
4.0
branch -git checkout 4.0
phpunit tests/AllTests.php
and see a test count at the bottom of 567 tests having run.phpunit tests/AllTests.php
and see a test count of 368 tests having run.The solution I found to fix this was to run the tests without the filename, so just running them with a plain
phpunit
call.So:
5. Run the following on any PHPUnit version to see the correct number of 567 tests being run:
phpunit
(without thetests/AllTests.php
)The fact the file name was still part of the default command is a project legacy from a time it was necessary, just don't ask me when that was 😉
Expected behavior
The test count to be the same cross-version.
External references:
PHP_CodeSniffer
repo: PHPCS 4.x | Test suite broken squizlabs/PHP_CodeSniffer#3120The text was updated successfully, but these errors were encountered: