Ejemplo n.º 1
0
 public function testInsulatedRequests()
 {
     if (!class_exists('Symfony\\Component\\Process\\Process')) {
         $this->markTestSkipped('The "Process" component is not available');
     }
     $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');
     }
 }