function DeprecationListenerTrait::deprecationEndTest
Same name and namespace in other branches
- 8.9.x core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php \Drupal\Tests\Listeners\DeprecationListenerTrait::deprecationEndTest()
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 DeprecationListenerTrait::deprecationEndTest()
- DrupalListener::endTest in core/
tests/ Drupal/ Tests/ Listeners/ DrupalListener.php
File
-
core/
tests/ Drupal/ Tests/ Listeners/ DeprecationListenerTrait.php, line 31
Class
- DeprecationListenerTrait
- Removes deprecations that we are yet to fix.
Namespace
Drupal\Tests\ListenersCode
protected function deprecationEndTest($test, $time) {
/** @var \PHPUnit\Framework\Test $test */
if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
$method = $test->getName(FALSE);
if (strpos($method, 'testLegacy') === 0 || strpos($method, 'provideLegacy') === 0 || strpos($method, 'getLegacy') === 0 || strpos(get_class($test), '\\Legacy') || in_array('legacy', Test::getGroups(get_class($test), $method), TRUE)) {
// This is a legacy test don't skip deprecations.
return;
}
// Need to edit the file of deprecations to remove any skipped
// deprecations.
$deprecations = file_get_contents($file);
$deprecations = $deprecations ? unserialize($deprecations) : [];
$resave = FALSE;
foreach ($deprecations as $key => $deprecation) {
if (static::isDeprecationSkipped($deprecation[1])) {
unset($deprecations[$key]);
$resave = TRUE;
}
}
if ($resave) {
file_put_contents($file, serialize($deprecations));
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.