function BrowserTestBaseTest::testDeprecationHeaders
Same name in other branches
- 9 core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testDeprecationHeaders()
- 8.9.x core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testDeprecationHeaders()
- 11.x core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testDeprecationHeaders()
Tests that deprecation headers do not get duplicated.
@group legacy
See also
\Drupal\Core\Test\HttpClientMiddleware\TestHttpClientMiddleware::__invoke()
File
-
core/
tests/ Drupal/ FunctionalTests/ BrowserTestBaseTest.php, line 588
Class
- BrowserTestBaseTest
- Tests BrowserTestBase functionality.
Namespace
Drupal\FunctionalTestsCode
public function testDeprecationHeaders() : void {
$this->drupalGet('/test-deprecations');
$deprecation_messages = [];
foreach ($this->getSession()
->getResponseHeaders() as $name => $values) {
if (preg_match('/^X-Drupal-Assertion-[0-9]+$/', $name, $matches)) {
foreach ($values as $value) {
$parameters = unserialize(urldecode($value));
if (count($parameters) === 3) {
if ($parameters[1] === 'User deprecated function') {
$deprecation_messages[] = (string) $parameters[0];
}
}
}
}
}
$this->assertContains('Test deprecation message', $deprecation_messages);
$test_deprecation_messages = array_filter($deprecation_messages, function ($message) {
return $message === 'Test deprecation message';
});
$this->assertCount(1, $test_deprecation_messages);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.