You are here

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

File

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

Class

ClientTest

Namespace

Symfony\Component\BrowserKit\Tests

Code

public function testRequestURIConversion() {
  $client = new TestClient();
  $client
    ->request('GET', '/foo');
  $this
    ->assertEquals('http://localhost/foo', $client
    ->getRequest()
    ->getUri(), '->request() converts the URI to an absolute one');
  $client = new TestClient();
  $client
    ->request('GET', 'http://www.example.com');
  $this
    ->assertEquals('http://www.example.com', $client
    ->getRequest()
    ->getUri(), '->request() does not change absolute URIs');
  $client = new TestClient();
  $client
    ->request('GET', 'http://www.example.com/');
  $client
    ->request('GET', '/foo');
  $this
    ->assertEquals('http://www.example.com/foo', $client
    ->getRequest()
    ->getUri(), '->request() uses the previous request for relative URLs');
  $client = new TestClient();
  $client
    ->request('GET', 'http://www.example.com/foo');
  $client
    ->request('GET', '#');
  $this
    ->assertEquals('http://www.example.com/foo#', $client
    ->getRequest()
    ->getUri(), '->request() uses the previous request for #');
  $client
    ->request('GET', '#');
  $this
    ->assertEquals('http://www.example.com/foo#', $client
    ->getRequest()
    ->getUri(), '->request() uses the previous request for #');
  $client
    ->request('GET', '#foo');
  $this
    ->assertEquals('http://www.example.com/foo#foo', $client
    ->getRequest()
    ->getUri(), '->request() uses the previous request for #');
  $client = new TestClient();
  $client
    ->request('GET', 'http://www.example.com/foo/');
  $client
    ->request('GET', 'bar');
  $this
    ->assertEquals('http://www.example.com/foo/bar', $client
    ->getRequest()
    ->getUri(), '->request() uses the previous request for relative URLs');
  $client = new TestClient();
  $client
    ->request('GET', 'http://www.example.com/foo/foobar');
  $client
    ->request('GET', 'bar');
  $this
    ->assertEquals('http://www.example.com/foo/bar', $client
    ->getRequest()
    ->getUri(), '->request() uses the previous request for relative URLs');
  $client = new TestClient();
  $client
    ->request('GET', 'http://www.example.com/foo/');
  $client
    ->request('GET', 'http');
  $this
    ->assertEquals('http://www.example.com/foo/http', $client
    ->getRequest()
    ->getUri(), '->request() uses the previous request for relative URLs');
  $client = new TestClient();
  $client
    ->request('GET', 'http://www.example.com/foo');
  $client
    ->request('GET', 'http/bar');
  $this
    ->assertEquals('http://www.example.com/http/bar', $client
    ->getRequest()
    ->getUri(), '->request() uses the previous request for relative URLs');
  $client = new TestClient();
  $client
    ->request('GET', 'http://www.example.com/');
  $client
    ->request('GET', 'http');
  $this
    ->assertEquals('http://www.example.com/http', $client
    ->getRequest()
    ->getUri(), '->request() uses the previous request for relative URLs');
}