You are here

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

File

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

Class

ClientTest

Namespace

Symfony\Component\BrowserKit\Tests

Code

public function testFollowRelativeRedirect() {
  $client = new TestClient();
  $client
    ->setNextResponse(new Response('', 302, array(
    'Location' => '/redirected',
  )));
  $client
    ->request('GET', 'http://www.example.com/foo/foobar');
  $this
    ->assertEquals('http://www.example.com/redirected', $client
    ->getRequest()
    ->getUri(), '->followRedirect() follows a redirect if any');
  $client = new TestClient();
  $client
    ->setNextResponse(new Response('', 302, array(
    'Location' => '/redirected:1234',
  )));
  $client
    ->request('GET', 'http://www.example.com/foo/foobar');
  $this
    ->assertEquals('http://www.example.com/redirected:1234', $client
    ->getRequest()
    ->getUri(), '->followRedirect() follows relative urls');
}