You are here

protected function BrowserTestBaseUserAgentTest::prepareRequest in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/BrowserTestBaseUserAgentTest.php \Drupal\FunctionalTests\BrowserTestBaseUserAgentTest::prepareRequest()

Prepare for a request to testing site.

The testing site is protected via a SIMPLETEST_USER_AGENT cookie that is checked by drupal_valid_test_ua().

Overrides UiHelperTrait::prepareRequest

See also

drupal_valid_test_ua()

File

core/tests/Drupal/FunctionalTests/BrowserTestBaseUserAgentTest.php, line 63

Class

BrowserTestBaseUserAgentTest
Tests BrowserTestBase functionality.

Namespace

Drupal\FunctionalTests

Code

protected function prepareRequest() {
  $session = $this
    ->getSession();
  if ($this->agent) {
    $session
      ->setCookie('SIMPLETEST_USER_AGENT', $this->agent);
  }
  else {
    $session
      ->setCookie('SIMPLETEST_USER_AGENT', drupal_generate_test_ua($this->databasePrefix));
  }
}