use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\Tests\EntityViewTrait;
use Drupal\Tests\block\Traits\BlockCreationTrait as BaseBlockCreationTrait;
+use Drupal\Tests\Listeners\DeprecationListenerTrait;
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
use Drupal\Tests\node\Traits\NodeCreationTrait;
use Drupal\Tests\Traits\Core\CronRunTrait;
// generated by _drupal_log_error() in the exact form required
// by \Drupal\simpletest\WebTestBase::error().
if (preg_match('/^X-Drupal-Assertion-[0-9]+: (.*)$/', $header, $matches)) {
- // Call \Drupal\simpletest\WebTestBase::error() with the parameters from
- // the header.
- call_user_func_array([&$this, 'error'], unserialize(urldecode($matches[1])));
+ $parameters = unserialize(urldecode($matches[1]));
+ // Handle deprecation notices triggered by system under test.
+ if ($parameters[1] === 'User deprecated function') {
+ if (getenv('SYMFONY_DEPRECATIONS_HELPER') !== 'disabled') {
+ $message = (string) $parameters[0];
+ if (!in_array($message, DeprecationListenerTrait::getSkippedDeprecations())) {
+ call_user_func_array([&$this, 'error'], $parameters);
+ }
+ }
+ }
+ else {
+ // Call \Drupal\simpletest\WebTestBase::error() with the parameters from
+ // the header.
+ call_user_func_array([&$this, 'error'], $parameters);
+ }
}
// Save cookies.
* The result of the request.
*/
protected function drupalGetWithFormat($path, $format, array $options = [], array $headers = []) {
- $options += ['query' => ['_format' => $format]];
+ $options = array_merge_recursive(['query' => ['_format' => $format]], $options);
return $this->drupalGet($path, $options, $headers);
}