You are here

public function DrupalMinkClient::request in Drupal 8

File

core/tests/Drupal/BuildTests/Framework/DrupalMinkClient.php, line 56

Class

DrupalMinkClient
Extend the Mink client for Drupal use-cases.

Namespace

Drupal\BuildTests\Framework

Code

public function request($method, $uri, array $parameters = [], array $files = [], array $server = [], $content = NULL, $changeHistory = TRUE) {
  $this->crawler = parent::request($method, $uri, $parameters, $files, $server, $content, $changeHistory);

  // Check for meta refresh redirect and follow it.
  if ($this->followMetaRefresh && NULL !== ($redirect = $this
    ->getMetaRefreshUrl())) {
    $this->redirect = $redirect;

    // $this->redirects is private on the BrowserKit client, so we have to use
    // reflection to manage the redirects stack.
    $ref_redirects = new \ReflectionProperty(SymfonyClient::class, 'redirects');
    $ref_redirects
      ->setAccessible(TRUE);
    $redirects = $ref_redirects
      ->getValue($this);
    $redirects[serialize($this->history
      ->current())] = TRUE;
    $ref_redirects
      ->setValue($this, $redirects);
    $this->crawler = $this
      ->followRedirect();
  }
  return $this->crawler;
}