Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up to #2721355: MissingDependentModuleUnitTest has the wrong namespace
Problem/Motivation
phpunit is currently unable to run the core kernel test suite because it can't handle the @dependencies annotation used in simpletest.
SIMPLETEST_DB='...' ./vendor/bin/phpunit -c ./core/phpunit.xml.dist --testsuite=kernel --stop-on-fail
PHPUnit 4.8.11 by Sebastian Bergmann and contributors.
............................................................. 61 / 1325 ( 4%)
............................................................. 122 / 1325 ( 9%)
............................................................. 183 / 1325 ( 13%)
............................................................. 244 / 1325 ( 18%)
............................................................. 305 / 1325 ( 23%)
............................................................. 366 / 1325 ( 27%)
............................................................. 427 / 1325 ( 32%)
............................................................. 488 / 1325 ( 36%)
..............................F
Time: 14.5 minutes, Memory: 38.00Mb
There was 1 failure:
1) Drupal\simpletest\Tests\MissingDependentModuleUnitTest::testFail
Running test with missing required module.
FAILURES!
Tests: 519, Assertions: 7809, Failures: 1.
Maybe the real fix is this should be moved back to simpletest since its testing its discovery.
Proposed resolution
In #2456477: Convert deprecated \Drupal\simpletest\KernelTestBase tests to KernelTestBaseNG MissingDependentModuleUnitTest was moved from being a Simpletest test into a Kernel test.
Turn MissingDependentModuleUnitTest
back into a Simpletest test.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#9 | 2722731_9.patch | 1.13 KB | Mile23 |
Comments
Comment #2
neclimdulgosh darn issue clone...
Comment #3
neclimdulUnfortunately, testbot isn't going to help with this review... :-/
Comment #5
neclimdulRandom failure in migrations somewhere. Back to review.
Comment #6
Mile23Over in #2721355: MissingDependentModuleUnitTest has the wrong namespace @alexpott says "@neclimdul actually I think your real fix is the right fix :)" in response to "Maybe the real fix is this should be moved back to simpletest since its testing its discovery."
Therefore I'm updating the summary and setting this to needs work.
Comment #7
neclimdulEasy enough.
Comment #8
neclimdulI made a mess of this. Lets go back to the original issue and solve the phpunit support here #2728579: Explicitly skip @requires module in PHPUnit Kernel and Browser tests.
Comment #9
Mile23I'm re-opening this because #2728579: Explicitly skip @requires module in PHPUnit Kernel and Browser tests has a wider scope and really all I want is passing tests right now. :-)
If i say:
I get:
If we want to leave
MissingDependentModuleUnitTest
as aKernel
test, then we should mark it as skipped or incomplete.Also rename it so it doesn't have Unit in the name.
Comment #10
Mile23Comment #11
klausiSo this test was wrongly converted from Simpletest to PHPUnit in #2770921: Feb 21st: Convert chunk of WTB to BTB by just moving classes, changing use statements adding traits.
I think we should just move this test back to Simpletest to keep the test coverage there. Then continue at #2728579: Explicitly skip @requires module in PHPUnit Kernel and Browser tests to finish the @require module support in PHPUnit.
Comment #12
Mile23Unfortunately, it still fails when it's a WTB and you run it directly, since only
TestDiscovery
enforces@dependencies
.When you look at this behavior in
TestDiscovery
here: http://cgit.drupalcode.org/drupal/tree/core/modules/simpletest/src/TestD......you see that it has a @todo for #1273478: Implement @requires and @dependencies within TestBase, mark tests as skipped which is a long-standing task which is still open.
MissingDependentModuleUnitTest
is really a test of that behavior, since it can (and does) fail depending on how you run it, which means that it's incomplete as a WTB as well.Either way it's incomplete, and an annoyance for the thing I'm trying to accomplish, which is this: #2296615: Accurately support multiple @groups per test class
Also, if it's meant to be finished in #2728579: Explicitly skip @requires module in PHPUnit Kernel and Browser tests then it shouldn't be a WTB test in the first place.
Comment #13
klausiOK, since this is broken anyway I agree about marking it as incomplete.
Comment #14
alexpottThe thing is at the moment this is the only test coverage of
@dependencies
so if we do this and we change TestDiscovery and break it then we won't know. I think just need to do #2728579: Explicitly skip @requires module in PHPUnit Kernel and Browser tests and not lose this test coverage. If you want to run all the functional tests use run-tests.sh or use--exclude-group simpletest
because people outside of the core test runs want to test the simpletest code.Comment #15
Mile23OK, so we have work happening on #2728579: Explicitly skip @requires module in PHPUnit Kernel and Browser tests and its follow-up #2857977: Support @require module in BrowserTestBase tests since it seems we're not going to simply mark this test incomplete or delete it. Note that #2728579-27: Explicitly skip @requires module in PHPUnit Kernel and Browser tests deletes the test from this issue in favor of two tests that are falsifiable.
I'll just put off #2296615: Accurately support multiple @groups per test class until the yak is shaved, by which time there will be zero people with momentum on any of it.
Comment #16
klausiOK, so let's continue at #2728579: Explicitly skip @requires module in PHPUnit Kernel and Browser tests.