getPathFromLocationHeader example

    // cookie without the secure attribute set. While this cookie will be stored     // in the Guzzle CookieJar, it will not be used on subsequent requests.     // Update the BrowserKit CookieJar so that subsequent requests have the     // correct cookie.     $cookie = $guzzle_cookie_jar->getCookieByName($this->insecureSessionName);
    $this->assertFalse($cookie->getSecure(), 'The insecure cookie does not have the secure attribute');
    /** @var \Symfony\Component\BrowserKit\CookieJar $browser_kit_cookie_jar */
    $browser_kit_cookie_jar = $this->getSession()->getDriver()->getClient()->getCookieJar();
    $browser_kit_cookie_jar->updateFromSetCookie($response->getHeader('Set-Cookie')$this->baseUrl);

    // Follow the location header.     $path = $this->getPathFromLocationHeader($response, FALSE);
    $parsed_path = parse_url($path);
    $query = [];
    if (isset($parsed_path['query'])) {
      parse_str($parsed_path['query']$query);
    }
    $this->drupalGet($this->httpUrl($parsed_path['path'])['query' => $query]);
    $this->assertSession()->statusCodeEquals(200);
  }

  /** * Log in a user via HTTPS. * * Note that the parents $session_id and $loggedInUser is not updated. */
Home | Imprint | This part of the site doesn't use cookies.