function DrupalComponentTestListenerTrait::componentEndTest
Same name in other branches
- 9 core/tests/Drupal/Tests/Listeners/DrupalComponentTestListenerTrait.php \Drupal\Tests\Listeners\DrupalComponentTestListenerTrait::componentEndTest()
- 8.9.x core/tests/Drupal/Tests/Listeners/DrupalComponentTestListenerTrait.php \Drupal\Tests\Listeners\DrupalComponentTestListenerTrait::componentEndTest()
- 11.x core/tests/Drupal/Tests/Listeners/DrupalComponentTestListenerTrait.php \Drupal\Tests\Listeners\DrupalComponentTestListenerTrait::componentEndTest()
Reacts to the end of a test.
Parameters
\PHPUnit\Framework\Test $test: The test object that has ended its test run.
float $time: The time the test took.
1 call to DrupalComponentTestListenerTrait::componentEndTest()
- DrupalListener::endTest in core/
tests/ Drupal/ Tests/ Listeners/ DrupalListener.php
File
-
core/
tests/ Drupal/ Tests/ Listeners/ DrupalComponentTestListenerTrait.php, line 27
Class
- DrupalComponentTestListenerTrait
- Ensures that no component tests are extending a core test base class.
Namespace
Drupal\Tests\ListenersCode
protected function componentEndTest($test, $time) {
/** @var \PHPUnit\Framework\Test $test */
if (str_starts_with($test->toString(), 'Drupal\\Tests\\Component')) {
if ($test instanceof BrowserTestBase || $test instanceof KernelTestBase || $test instanceof UnitTestCase) {
$error = new AssertionFailedError('Component tests should not extend a core test base class.');
$test->getTestResultObject()
->addFailure($test, $error, $time);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.