Details
-
Bug
-
Resolution: Not a bug
-
Blocker
-
None
-
2.6
-
None
-
MOODLE_26_STABLE
Description
Noticed whilst writing some additional tests for backup/util/dbops/tests/dbops_test.php
There are two classes in dbops_test.php, each with valid test cases.
Running vendor/bin/phpunit in a variety of ways only tests the first class, and not subsequent classes.
Specify by file:
vendor/bin/phpunit backup/util/dbops/tests/dbops_test.php
|
Edit phpunit.xml and remove all testsuites. Add the following instead:
<testsuites>
|
<testsuite name="core_backup">
|
<directory suffix="_test.php">backup/util/dbops</directory>
|
</testsuite>
|
|
</testsuites>
|
Now run:
vendor/bin/phpunit --testsuite core_backup
|
Or even:
vendor/bin/phpunit
|
You'll notice that each of these only runs a single test, with 19 assertions. None of the tests in the second class are tested at all.
This also happens for lib/tests/pagelib_test.php. I suspect that there are other places where multiple tests exist in the same file, but I've not tested.