public function testExample() { $exmp = new Example(); $this->assertEquals(strpos($exmp->test(), 'h') == 2, true); }
$this->maxPage = $match[1]; } } } class YgdyDetailCrawler extends \Hanccc\DetailCrawler { /** * @param $url string * @return bool */ public function isDetailUrl($url) { return preg_match('/gndy\\/dyzz\\/(\\d+)\\/(\\d+).html/', $url); } public function handle() { echo $this->crawler->filter('title')->text() . PHP_EOL; } } class Example { function test() { $listCrawler = new YgdyListCrawler(__DIR__ . '/'); $listCrawler->setDetailCrawler(new YgdyDetailCrawler()); $listCrawler->start(); } } $test = new Example(); $test->test();