You are here

public function ClientTest::testFollowRedirectWithHeaders 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::testFollowRedirectWithHeaders()

File

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

Class

ClientTest

Namespace

Symfony\Component\BrowserKit\Tests

Code

public function testFollowRedirectWithHeaders() {
  $headers = array(
    'HTTP_HOST' => 'www.example.com',
    'HTTP_USER_AGENT' => 'Symfony2 BrowserKit',
    'CONTENT_TYPE' => 'application/vnd.custom+xml',
    'HTTPS' => false,
  );
  $client = new TestClient();
  $client
    ->followRedirects(false);
  $client
    ->setNextResponse(new Response('', 302, array(
    'Location' => 'http://www.example.com/redirected',
  )));
  $client
    ->request('GET', 'http://www.example.com/', array(), array(), array(
    'CONTENT_TYPE' => 'application/vnd.custom+xml',
  ));
  $this
    ->assertEquals($headers, $client
    ->getRequest()
    ->getServer());
  $client
    ->followRedirect();
  $headers['HTTP_REFERER'] = 'http://www.example.com/';
  $this
    ->assertEquals($headers, $client
    ->getRequest()
    ->getServer());
}