Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Nov 14, 2020
1 parent 32024c8 commit e0f6e96
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function run(RequestResponse $requestResponse, Crawler $crawler)

if ($parserResult->ignore) {
// for whatever reason the parser ignores this url
unset($parserResult);
continue;
}

Expand Down
15 changes: 15 additions & 0 deletions tests/CrawlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ public function testRunCrawler()
$this->assertNotEmpty($debug->elapsedTime());
}

public function testRunCrawlerWithGivenFilter()
{
$debug = new DebugHandler();

$crawler = new Crawler('https://luya.io', new ArrayStorage, new LoopRunner);
$crawler->urlFilterRules = [
'#/news#i'
];
$crawler->addParser(new HtmlParser);
$crawler->addHandler($debug);
$this->assertEmpty($crawler->setup());
$this->assertEmpty($crawler->run());
$this->assertNotEmpty($debug->elapsedTime());
}

public function testRunCrawlerButSkipResponseDueToVerySmallLimit()
{
$debug = new DebugHandler();
Expand Down

0 comments on commit e0f6e96

Please sign in to comment.