diff --git a/core/modules/history/tests/src/Functional/HistoryTest.php b/core/modules/history/tests/src/Functional/HistoryTest.php index f30dc59..74d3628 100644 --- a/core/modules/history/tests/src/Functional/HistoryTest.php +++ b/core/modules/history/tests/src/Functional/HistoryTest.php @@ -45,6 +45,13 @@ class HistoryTest extends BrowserTestBase { */ protected $client; + /** + * The Guzzle HTTP client. + * + * @var \GuzzleHttp\Cookie\CookieJar; + */ + protected $cookies; + protected function setUp() { parent::setUp(); @@ -56,11 +63,8 @@ protected function setUp() { $domain = parse_url($this->getUrl(), PHP_URL_HOST); $session_id = $this->getSession()->getCookie($this->getSessionName()); - $opts = [ - 'cookies' => CookieJar::fromArray([$this->getSessionName() => $session_id], $domain), - 'http_errors' => FALSE, - ]; - $this->client = \Drupal::service('http_client_factory')->fromOptions($opts); + $this->cookies = CookieJar::fromArray([$this->getSessionName() => $session_id], $domain); + $this->client = $this->getSession()->getDriver()->getClient()->getClient(); } /** @@ -79,10 +83,12 @@ protected function getNodeReadTimestamps(array $node_ids) { ->toString(); return $this->client->post($url, [ 'body' => http_build_query(['node_ids' => $node_ids]), + 'cookies' => $this->cookies, 'headers' => [ 'Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded', ], + 'http_errors' => FALSE, ]); } @@ -98,9 +104,11 @@ protected function getNodeReadTimestamps(array $node_ids) { protected function markNodeAsRead($node_id) { $url = Url::fromRoute('history.read_node', array('node' => $node_id), array('absolute' => TRUE))->toString(); return $this->client->post($url, [ + 'cookies' => $this->cookies, 'headers' => [ 'Accept' => 'application/json', ], + 'http_errors' => FALSE, ]); }