示例#1
0
 protected function createCrawlerFromContent($uri, $content, $type)
 {
     $crawler = new Crawler(null, $uri);
     $crawler->addContent($content, $type);
     return $crawler;
 }
示例#2
0
 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');
 }
示例#3
0
 public function testClear()
 {
     $crawler = new Crawler(new \DOMNode());
     $crawler->clear();
     $this->assertEquals(0, count($crawler), '->clear() removes all the nodes from the crawler');
 }