You are here

public function ClientTest::testDoRequest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/ClientTest.php \Symfony\Component\HttpKernel\Tests\ClientTest::testDoRequest()

File

vendor/symfony/http-kernel/Tests/ClientTest.php, line 23

Class

ClientTest

Namespace

Symfony\Component\HttpKernel\Tests

Code

public function testDoRequest() {
  $client = new Client(new TestHttpKernel());
  $client
    ->request('GET', '/');
  $this
    ->assertEquals('Request: /', $client
    ->getResponse()
    ->getContent(), '->doRequest() uses the request handler to make the request');
  $this
    ->assertInstanceOf('Symfony\\Component\\BrowserKit\\Request', $client
    ->getInternalRequest());
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Request', $client
    ->getRequest());
  $this
    ->assertInstanceOf('Symfony\\Component\\BrowserKit\\Response', $client
    ->getInternalResponse());
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $client
    ->getResponse());
  $client
    ->request('GET', 'http://www.example.com/');
  $this
    ->assertEquals('Request: /', $client
    ->getResponse()
    ->getContent(), '->doRequest() uses the request handler to make the request');
  $this
    ->assertEquals('www.example.com', $client
    ->getRequest()
    ->getHost(), '->doRequest() uses the request handler to make the request');
  $client
    ->request('GET', 'http://www.example.com/?parameter=http://google.com');
  $this
    ->assertEquals('http://www.example.com/?parameter=' . urlencode('http://google.com'), $client
    ->getRequest()
    ->getUri(), '->doRequest() uses the request handler to make the request');
}