function DrupalTestCase::skipTestWithAttribute

Supports skipping tests with the Skip attribute.

This is run with a high priority to prevent any setUp() functions from executing, avoiding any Drupal bootstrap.

@internal

Attributes

#[Before(200)]

File

core/tests/Drupal/Tests/DrupalTestCase.php, line 33

Class

DrupalTestCase
Provides the root base class for all Drupal core tests.

Namespace

Drupal\Tests

Code

final protected function skipTestWithAttribute() : void {
  $reflection = new \ReflectionMethod(static::class, $this->name());
  $attribute = $reflection->getAttributes(Skip::class, \ReflectionAttribute::IS_INSTANCEOF)[0] ?? NULL;
  if ($attribute) {
    static::markTestSkipped($attribute->newInstance()->message);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.