X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsimpletest%2Fsrc%2FWebTestBase.php;fp=web%2Fcore%2Fmodules%2Fsimpletest%2Fsrc%2FWebTestBase.php;h=441b2398f4b967a3b78c2c0b6c213fb417e9fd2c;hp=fd0222fabccb65d5762ea32d6931f2ce7de9a195;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/modules/simpletest/src/WebTestBase.php b/web/core/modules/simpletest/src/WebTestBase.php index fd0222fab..441b2398f 100644 --- a/web/core/modules/simpletest/src/WebTestBase.php +++ b/web/core/modules/simpletest/src/WebTestBase.php @@ -18,6 +18,7 @@ use Drupal\Core\Url; 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; @@ -692,9 +693,21 @@ abstract class WebTestBase extends TestBase { // 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. @@ -819,7 +832,7 @@ abstract class WebTestBase extends TestBase { * 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); }