When run Kernel tests with Drupal 8.9.x core, and without Redirect module installed, I can see following error:

1) Drupal\Tests\tome_static\Kernel\StaticRedirectTest::testRedirect
PHPUnit\Framework\Exception: Unavailable module: 'redirect'. If this module needs to be downloaded separately, annotate the test class with '@requires module redirect'.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sakiland created an issue. See original summary.

sakiland’s picture

Status: Active » Needs review
FileSize
523 bytes

Here's patch
I've just added @requires module redirect annotation.

samuel.mortenson’s picture

Redirect is already listed as a test dependency https://git.drupalcode.org/project/tome/-/blob/8.x-1.x/tome.info.yml#L10-14, I haven't had to add @requires before. Is this only required for this specific test?

sakiland’s picture

Status: Needs review » Needs work

I've just checked git history, this is related to issue and merged into 8.8.x release.

I will check if there is need to change any other annotation in Tome's tests.

sakiland’s picture

Priority: Normal » Minor
Status: Needs work » Needs review

I've checked, this is the only place where we need to change annotation. I run all tests from directory tome/modules/tome_static/tests/src/Kernel

Here's output without fix

$ ddev exec /var/www/html/public_html/vendor/bin/phpunit

PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Testing basic-functional
......................E                                           23 / 23 (100%)

Time: 2.17 minutes, Memory: 4.00MB

There was 1 error:

1) Drupal\Tests\tome_static\Kernel\StaticRedirectTest::testRedirect
PHPUnit\Framework\Exception: Unavailable module: 'redirect'. If this module needs to be downloaded separately, annotate the test class with '@requires module redirect'.

/var/www/html/public_html/core/tests/Drupal/KernelTests/KernelTestBase.php:508
/var/www/html/public_html/core/tests/Drupal/KernelTests/KernelTestBase.php:353
/var/www/html/public_html/core/tests/Drupal/KernelTests/KernelTestBase.php:246
/var/www/html/public_html/modules/tome/modules/tome_base/tests/src/Kernel/TestBase.php:45
/var/www/html/public_html/modules/tome/modules/tome_static/tests/src/Kernel/StaticRedirectTest.php:31

ERRORS!
Tests: 23, Assertions: 146, Errors: 1.
Failed to execute command /var/www/html/public_html/vendor/bin/phpunit: exit status 2 

and with fix

$ ddev exec /var/www/html/public_html/vendor/bin/phpunit

PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Testing basic-functional
......................S                                           23 / 23 (100%)

Time: 2.2 minutes, Memory: 4.00MB

OK, but incomplete, skipped, or risky tests!
Tests: 23, Assertions: 146, Skipped: 1.

  • sakiland authored 7398d91 on 8.x-1.x
    Issue #3156466 by sakiland: Kernel test error without Redirect module...
samuel.mortenson’s picture

Status: Needs review » Fixed

Thank you for checking!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.