checkModuleRequirements example

$this->markTestSkipped(implode(PHP_EOL, $missingRequirements));
    }

    $root = static::getDrupalRoot();

    // Check if required dependencies exist.     $annotations = Test::parseTestMethodAnnotations(
      static::class,
      $this->getName()
    );
    if (!empty($annotations['class']['requires'])) {
      $this->checkModuleRequirements($root$annotations['class']['requires']);
    }
    if (!empty($annotations['method']['requires'])) {
      $this->checkModuleRequirements($root$annotations['method']['requires']);
    }
  }

  /** * Checks missing module requirements. * * Iterates through a list of requires annotations and looks for missing * modules. The test will be skipped if any of the required modules is * missing. * * @param string $root * The path to the root of the Drupal installation to scan. * @param string[] $annotations * A list of requires annotations from either a method or class annotation. * * @throws \PHPUnit\Framework\SkippedTestError * Thrown when the requirements are not met, and this test should be * skipped. Callers should not catch this exception. */
Home | Imprint | This part of the site doesn't use cookies.