PHPUnit error due to OrderKernelTestBase class not found

Created on 19 May 2023, over 1 year ago
Updated 22 May 2023, over 1 year ago

Problem/Motivation

It looks like the annotation requires module commerce_order of certain tests is not effective in excluding the test from phpunit. Possibly related to issue #3261817: TestRequirementsTrait::checkRequirements() does not work as expected β†’ .

Steps to reproduce

Running phpunit -c core --testsuite=kernel results in the following error:

Fatal error: Uncaught Error: Class "Drupal\Tests\commerce_order\Kernel\OrderKernelTestBase" not found in /var/www/html/web/modules/contrib/google_tag/tests/src/Kernel/Events/CommerceRefundEventTest.php:19
πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden meanderix

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @meanderix
  • πŸ‡ΊπŸ‡ΈUnited States mglaman WI, USA

    We need to copy over this boilerplate:

      /**
       * {@inheritdoc}
       */
      protected function setUp(): void {
        // PHPUnit has `checkRequirements` as a private method since 9.x.
        // We run Drupal's `checkRequirements` again, here, to verify our module
        // requirement.
        // @todo remove after https://www.drupal.org/i/3261817
        $this->checkRequirements();
    

    But I'm not sure if it will work since the base class comes from the dev dependency.

Production build 0.71.5 2024