/** * Returns the DOM crawler which can be used to interact with the web page * structure, submit forms, click links or fetch specific parts of the * website's contents. * * The returned DOM crawler is bound to the response of the last executed * request. * * @return \Symfony\Component\DomCrawler\Crawler * @api */ public function getCrawler() { $crawler = new Crawler(NULL, $this->lastRequest->getBaseUri()); $crawler->addContent($this->lastResponse->getContent(), $this->lastResponse->getHeader('Content-Type')); return $crawler; }
/** * @test */ public function contentCanBeSetAppendedAndRetrieved() { $response = new Response(); $response->setContent('Two households, both alike in dignity, '); $response->appendContent('In fair Verona, where we lay our scene'); $this->assertEquals('Two households, both alike in dignity, In fair Verona, where we lay our scene', $response->getContent()); $response->setContent('For never was a story of more woe, Than this of Juliet and her Romeo.'); $this->assertEquals('For never was a story of more woe, Than this of Juliet and her Romeo.', $response->getContent()); $this->assertEquals('For never was a story of more woe, Than this of Juliet and her Romeo.', (string) $response); }