See https://www.drupal.org/pift-ci-job/1636321

The test classes do indeed have the annotation to require the token module.

See https://git.drupalcode.org/project/file_download_link/-/blob/8.x-1.x/tes...

I don't understand why the tests are failing.

1) Drupal\Tests\file_download_link\Kernel\FileDownloadLinkTokenTest::testFormatterFileTokens
PHPUnit\Framework\Exception: Unavailable module: 'token'. If this module needs to be downloaded separately, annotate the test class with '@requires module token'.

/var/www/html/core/tests/Drupal/KernelTests/KernelTestBase.php:499
/var/www/html/core/tests/Drupal/KernelTests/KernelTestBase.php:346
/var/www/html/core/tests/Drupal/KernelTests/KernelTestBase.php:242
/var/www/html/modules/contrib/file_download_link/tests/src/Kernel/FileDownloadLinkTokenTest.php:41
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:691

Comments

danflanagan8 created an issue. See original summary.

danflanagan8’s picture

Issue summary: View changes
danflanagan8’s picture

Issue summary: View changes
danflanagan8’s picture

I found another contrib module that has a test class that requires token. Their tests do not throw the same error. Here's a link to the test class:

https://git.drupalcode.org/project/address/-/blob/8.x-1.x/tests/src/Kern...

The patch I am uploading switches the order of @group and @requires in the annotations to match the order in the test class I linked to. Maybe that'll fix the problem?

danflanagan8’s picture

That patch didn't work...This new patch adds a composer.json so I can set token in require-dev.

danflanagan8’s picture

Just to keep things clean, this patch reverses the swap in annotation order since it wasn't needed. This patch also adds license and homepage to composer.json.

  • danflanagan8 committed 4d70f22 on 8.x-1.x
    Issue #3124523 by danflanagan8: Drupal 9 test classes fail when...
danflanagan8’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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