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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

neclimdul created an issue. See original summary.

neclimdul’s picture

Status: Reviewed & tested by the community » Active

gosh darn issue clone...

neclimdul’s picture

Title: MissingDependentModuleUnitTest has the wrong namespace » MissingDependentModuleUnitTest fails in phpunit runner
Issue summary: View changes
Status: Active » Needs review
FileSize
1.13 KB

Unfortunately, testbot isn't going to help with this review... :-/

Status: Needs review » Needs work

The last submitted patch, 3: 2722731-3.patch, failed testing.

neclimdul’s picture

Status: Needs work » Needs review

Random failure in migrations somewhere. Back to review.

Mile23’s picture

Title: MissingDependentModuleUnitTest fails in phpunit runner » Convert MissingDependentModuleUnitTest back to a Simpletest test
Issue summary: View changes
Status: Needs review » Needs work

Over 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.

neclimdul’s picture

Status: Needs work » Needs review
FileSize
720 bytes

Easy enough.

neclimdul’s picture

Status: Needs review » Closed (duplicate)

I 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.

Mile23’s picture

Title: Convert MissingDependentModuleUnitTest back to a Simpletest test » Mark MissingDependentModuleUnitTest as incomplete
Version: 8.2.x-dev » 8.3.x-dev
Status: Closed (duplicate) » Needs work
FileSize
1.13 KB

I'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:

./vendor/bin/phpunit -c core/ --group simpletest --testsuite functional

I get:

There was 1 failure:

1) Drupal\Tests\simpletest\Functional\MissingDependentModuleUnitTest::testFail
Running test with missing required module.

/Users/paulmitchum/projects/drupal8/core/modules/simpletest/tests/src/Functional/MissingDependentModuleUnitTest.php:19

If we want to leave MissingDependentModuleUnitTest as a Kernel test, then we should mark it as skipped or incomplete.

Also rename it so it doesn't have Unit in the name.

Mile23’s picture

Status: Needs work » Needs review
klausi’s picture

Status: Needs review » Needs work

So 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.

Mile23’s picture

Status: Needs work » Needs review

Unfortunately, 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.

klausi’s picture

Status: Needs review » Reviewed & tested by the community

OK, since this is broken anyway I agree about marking it as incomplete.

alexpott’s picture

Status: Reviewed & tested by the community » Needs review

The 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.

Mile23’s picture

OK, 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.

klausi’s picture

Status: Needs review » Closed (duplicate)