You are here

protected function LingotekTestBase::getHttpClient in Lingotek Translation 3.1.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::getHttpClient()
  2. 4.0.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::getHttpClient()
  3. 3.0.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::getHttpClient()
  4. 3.2.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::getHttpClient()
  5. 3.3.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::getHttpClient()
  6. 3.4.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::getHttpClient()
  7. 3.5.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::getHttpClient()
  8. 3.6.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::getHttpClient()
  9. 3.7.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::getHttpClient()
  10. 3.8.x tests/src/Functional/LingotekTestBase.php \Drupal\Tests\lingotek\Functional\LingotekTestBase::getHttpClient()

Obtain the HTTP client and set the cookies.

Return value

\GuzzleHttp\Client The client with BrowserTestBase configuration.

Overrides BrowserTestBase::getHttpClient

1 call to LingotekTestBase::getHttpClient()
LingotekTestBase::setUp in tests/src/Functional/LingotekTestBase.php

File

tests/src/Functional/LingotekTestBase.php, line 523

Class

LingotekTestBase
Base class for Lingotek test. Performs authorization of the account.

Namespace

Drupal\Tests\lingotek\Functional

Code

protected function getHttpClient() {

  // Similar code is also employed to test CSRF tokens.
  // @see \Drupal\Tests\system\Functional\CsrfRequestHeaderTest::testRouteAccess()
  $domain = parse_url($this
    ->getUrl(), PHP_URL_HOST);
  $session_id = $this
    ->getSession()
    ->getCookie($this
    ->getSessionName());
  $this->cookies = CookieJar::fromArray([
    $this
      ->getSessionName() => $session_id,
  ], $domain);
  return $this
    ->getSession()
    ->getDriver()
    ->getClient()
    ->getClient();
}