better tests for interlinked and redirect tracking

This commit is contained in:
James
2020-02-24 09:07:58 +00:00
parent 5fc2b1fb83
commit 3ab51ccff9
4 changed files with 32 additions and 9 deletions

View File

@@ -76,23 +76,38 @@ class CrawlerTest extends TestCase{
public function testInterlinked(){
$crawler=new Crawler();
$crawler->crawl('http://localhost:8080/interlinked1');
//$crawler->crawl('http://localhost:8080/page4'); // TODO!!! this ensures the order or results for the URL tracking test 3PARTS.
$crawler->crawl('http://localhost:8080/interlinked4'); //this ensures the order or results for the URL tracking test PART2
$sitemap=$crawler->getResults();
$this->assertTreeContains($sitemap,[
'http://localhost:8080/interlinked1' => ['code' => 200 , 'foundOn' => [
'http://localhost:8080/interlinked1' => 1,
'http://localhost:8080/interlinked2' => 1,
'http://localhost:8080/interlinked3' => 1,
'http://localhost:8080/interlinked4' => 1,
]],
'http://localhost:8080/interlinked2' => ['code' => 200 , 'foundOn' => [
'http://localhost:8080/interlinked1' => 1,
'http://localhost:8080/interlinked2' => 1,
'http://localhost:8080/interlinked3' => 1,
'http://localhost:8080/interlinked4' => 1,
]],
'http://localhost:8080/interlinked3' => ['code' => 200 , 'foundOn' => [
'http://localhost:8080/interlinked1' => 1,
'http://localhost:8080/interlinked2' => 1,
'http://localhost:8080/interlinked3' => 1,
'http://localhost:8080/interlinked4' => 1,
]],
'http://localhost:8080/found' => ['code' => 200 , 'foundOn' => [
'http://localhost:8080/interlinked1' => 1,
'http://localhost:8080/interlinked2' => 1,
'http://localhost:8080/interlinked3' => 1,
'http://localhost:8080/interlinked4' => 1,
]],
'http://localhost:8080/redirectToFound' => ['code' => 302 , 'foundOn' => [
'http://localhost:8080/interlinked1' => 1,
'http://localhost:8080/interlinked2' => 1,
'http://localhost:8080/interlinked3' => 1,
'http://localhost:8080/interlinked4' => 1,
]],
], print_r($sitemap,true));
}