By dcam on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
11.5.x
Introduced in version:
11.5.0
Issue links:
Description:
A new PHP attribute, \Drupal\TestTools\Attribute\Skip is available to mark PHPUnit test methods to be skipped. Using the new attribute is preferred instead of calling \PHPUnit\Framework\Assert::markTestSkipped(). The presence of the attribute is checked before Drupal is bootstrapped in Kernel and Functional tests, providing a performance improvement when the test is skipped.
Before:
public function testFoo(): void {
$this->markTestSkipped('Information about why the test is skipped.');
// Test code.
}
public function testBar(): void {
$this->markTestSkipped();
// Test code.
}
After:
#[Skip('Information about why the test is skipped.')]
public function testFoo(): void {
// Test code.
}
#[Skip]
public function testBar(): void {
// Test code.
}
Impacts:
Module developers