You are here

public function ClientTest::testFollowRedirectWithCookies in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/browser-kit/Tests/ClientTest.php \Symfony\Component\BrowserKit\Tests\ClientTest::testFollowRedirectWithCookies()

File

vendor/symfony/browser-kit/Tests/ClientTest.php, line 436

Class

ClientTest

Namespace

Symfony\Component\BrowserKit\Tests

Code

public function testFollowRedirectWithCookies() {
  $client = new TestClient();
  $client
    ->followRedirects(false);
  $client
    ->setNextResponse(new Response('', 302, array(
    'Location' => 'http://www.example.com/redirected',
    'Set-Cookie' => 'foo=bar',
  )));
  $client
    ->request('GET', 'http://www.example.com/');
  $this
    ->assertEquals(array(), $client
    ->getRequest()
    ->getCookies());
  $client
    ->followRedirect();
  $this
    ->assertEquals(array(
    'foo' => 'bar',
  ), $client
    ->getRequest()
    ->getCookies());
}