You are here

public function ClientTest::testInsulatedRequests in Zircon Profile 8.0

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

File

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

Class

ClientTest

Namespace

Symfony\Component\BrowserKit\Tests

Code

public function testInsulatedRequests() {
  $client = new TestClient();
  $client
    ->insulate();
  $client
    ->setNextScript("new Symfony\\Component\\BrowserKit\\Response('foobar')");
  $client
    ->request('GET', 'http://www.example.com/foo/foobar');
  $this
    ->assertEquals('foobar', $client
    ->getResponse()
    ->getContent(), '->insulate() process the request in a forked process');
  $client
    ->setNextScript("new Symfony\\Component\\BrowserKit\\Response('foobar)");
  try {
    $client
      ->request('GET', 'http://www.example.com/foo/foobar');
    $this
      ->fail('->request() throws a \\RuntimeException if the script has an error');
  } catch (\Exception $e) {
    $this
      ->assertInstanceOf('RuntimeException', $e, '->request() throws a \\RuntimeException if the script has an error');
  }
}