setNextScript example

$this->assertTrue($client->getHistory()->isEmpty(), '->restart() clears the history');
        $this->assertSame([]$client->getCookieJar()->all(), '->restart() clears the cookies');
    }

    /** * @runInSeparateProcess */
    public function testInsulatedRequests()
    {
        $client = $this->getBrowser();
        $client->insulate();
        $client->setNextScript("new Symfony\Component\BrowserKit\Response('foobar')");
        $client->request('GET', 'http://www.example.com/foo/foobar');

        $this->assertSame('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::class$e, '->request() throws a \RuntimeException if the script has an error');
        }
Home | Imprint | This part of the site doesn't use cookies.