comparison core/modules/simpletest/src/WebTestBase.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 7a779792577d
children c2387f117808
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
16 use Drupal\Core\Test\FunctionalTestSetupTrait; 16 use Drupal\Core\Test\FunctionalTestSetupTrait;
17 use Drupal\Core\Url; 17 use Drupal\Core\Url;
18 use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait; 18 use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
19 use Drupal\Tests\EntityViewTrait; 19 use Drupal\Tests\EntityViewTrait;
20 use Drupal\Tests\block\Traits\BlockCreationTrait as BaseBlockCreationTrait; 20 use Drupal\Tests\block\Traits\BlockCreationTrait as BaseBlockCreationTrait;
21 use Drupal\Tests\Listeners\DeprecationListenerTrait;
21 use Drupal\Tests\node\Traits\ContentTypeCreationTrait; 22 use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
22 use Drupal\Tests\node\Traits\NodeCreationTrait; 23 use Drupal\Tests\node\Traits\NodeCreationTrait;
23 use Drupal\Tests\Traits\Core\CronRunTrait; 24 use Drupal\Tests\Traits\Core\CronRunTrait;
24 use Drupal\Tests\TestFileCreationTrait; 25 use Drupal\Tests\TestFileCreationTrait;
25 use Drupal\Tests\user\Traits\UserCreationTrait; 26 use Drupal\Tests\user\Traits\UserCreationTrait;
690 691
691 // Errors are being sent via X-Drupal-Assertion-* headers, 692 // Errors are being sent via X-Drupal-Assertion-* headers,
692 // generated by _drupal_log_error() in the exact form required 693 // generated by _drupal_log_error() in the exact form required
693 // by \Drupal\simpletest\WebTestBase::error(). 694 // by \Drupal\simpletest\WebTestBase::error().
694 if (preg_match('/^X-Drupal-Assertion-[0-9]+: (.*)$/', $header, $matches)) { 695 if (preg_match('/^X-Drupal-Assertion-[0-9]+: (.*)$/', $header, $matches)) {
695 // Call \Drupal\simpletest\WebTestBase::error() with the parameters from 696 $parameters = unserialize(urldecode($matches[1]));
696 // the header. 697 // Handle deprecation notices triggered by system under test.
697 call_user_func_array([&$this, 'error'], unserialize(urldecode($matches[1]))); 698 if ($parameters[1] === 'User deprecated function') {
699 if (getenv('SYMFONY_DEPRECATIONS_HELPER') !== 'disabled') {
700 $message = (string) $parameters[0];
701 if (!in_array($message, DeprecationListenerTrait::getSkippedDeprecations())) {
702 call_user_func_array([&$this, 'error'], $parameters);
703 }
704 }
705 }
706 else {
707 // Call \Drupal\simpletest\WebTestBase::error() with the parameters from
708 // the header.
709 call_user_func_array([&$this, 'error'], $parameters);
710 }
698 } 711 }
699 712
700 // Save cookies. 713 // Save cookies.
701 if (preg_match('/^Set-Cookie: ([^=]+)=(.+)/', $header, $matches)) { 714 if (preg_match('/^Set-Cookie: ([^=]+)=(.+)/', $header, $matches)) {
702 $name = $matches[1]; 715 $name = $matches[1];
817 * 830 *
818 * @return mixed 831 * @return mixed
819 * The result of the request. 832 * The result of the request.
820 */ 833 */
821 protected function drupalGetWithFormat($path, $format, array $options = [], array $headers = []) { 834 protected function drupalGetWithFormat($path, $format, array $options = [], array $headers = []) {
822 $options += ['query' => ['_format' => $format]]; 835 $options = array_merge_recursive(['query' => ['_format' => $format]], $options);
823 return $this->drupalGet($path, $options, $headers); 836 return $this->drupalGet($path, $options, $headers);
824 } 837 }
825 838
826 /** 839 /**
827 * Requests a path or URL in drupal_ajax format and JSON-decodes the response. 840 * Requests a path or URL in drupal_ajax format and JSON-decodes the response.