protected function createCrawlerFromContent($uri, $content, $type) { $crawler = new Crawler(null, $uri); $crawler->addContent($content, $type); return $crawler; }
public function testIsEmpty() { $crawler = new Crawler(new \DOMNode()); $this->assertFalse($crawler->isEmpty(), '->isEmpty() returns false if the crawler node list is not empty'); $crawler->clear(); $this->assertTrue($crawler->isEmpty(), '->isEmpty() returns true if the crawler node list is empty'); }
public function testClear() { $crawler = new Crawler(new \DOMNode()); $crawler->clear(); $this->assertEquals(0, count($crawler), '->clear() removes all the nodes from the crawler'); }