|
@@ 272-287 (lines=16) @@
|
| 269 |
|
$this->assertEquals($expected, $this->statsHandler->getPersisted()); |
| 270 |
|
} |
| 271 |
|
|
| 272 |
|
public function testCrawlBFSMaxDepthOne() |
| 273 |
|
{ |
| 274 |
|
$this->spider->getQueueManager()->setTraversalAlgorithm(InMemoryQueueManager::ALGORITHM_BREADTH_FIRST); |
| 275 |
|
$this->spider->getDiscovererSet()->maxDepth = 1; |
| 276 |
|
|
| 277 |
|
$this->spider->crawl(); |
| 278 |
|
|
| 279 |
|
$expected = array( |
| 280 |
|
$this->linkA, |
| 281 |
|
$this->linkB, |
| 282 |
|
$this->linkC, |
| 283 |
|
$this->linkE, |
| 284 |
|
); |
| 285 |
|
|
| 286 |
|
$this->assertEquals($expected, $this->statsHandler->getPersisted()); |
| 287 |
|
} |
| 288 |
|
|
| 289 |
|
/** |
| 290 |
|
* @covers VDB\Spider\Spider::crawl |
|
@@ 292-306 (lines=15) @@
|
| 289 |
|
/** |
| 290 |
|
* @covers VDB\Spider\Spider::crawl |
| 291 |
|
*/ |
| 292 |
|
public function testCrawlDFSMaxQueueSize() |
| 293 |
|
{ |
| 294 |
|
$this->spider->getDiscovererSet()->maxDepth = 1000; |
| 295 |
|
$this->spider->getDownloader()->setDownloadLimit(3); |
| 296 |
|
|
| 297 |
|
$this->spider->crawl(); |
| 298 |
|
|
| 299 |
|
$expected = array( |
| 300 |
|
$this->linkA, |
| 301 |
|
$this->linkE, |
| 302 |
|
$this->linkF, |
| 303 |
|
); |
| 304 |
|
|
| 305 |
|
$this->assertEquals($expected, $this->statsHandler->getPersisted()); |
| 306 |
|
} |
| 307 |
|
|
| 308 |
|
public function testCrawlBFSMaxQueueSize() |
| 309 |
|
{ |
|
@@ 308-323 (lines=16) @@
|
| 305 |
|
$this->assertEquals($expected, $this->statsHandler->getPersisted()); |
| 306 |
|
} |
| 307 |
|
|
| 308 |
|
public function testCrawlBFSMaxQueueSize() |
| 309 |
|
{ |
| 310 |
|
$this->spider->getQueueManager()->setTraversalAlgorithm(InMemoryQueueManager::ALGORITHM_BREADTH_FIRST); |
| 311 |
|
$this->spider->getDiscovererSet()->maxDepth = 1000; |
| 312 |
|
$this->spider->getDownloader()->setDownloadLimit(3); |
| 313 |
|
|
| 314 |
|
$this->spider->crawl(); |
| 315 |
|
|
| 316 |
|
$expected = array( |
| 317 |
|
$this->linkA, |
| 318 |
|
$this->linkB, |
| 319 |
|
$this->linkC, |
| 320 |
|
); |
| 321 |
|
|
| 322 |
|
$this->assertEquals($expected, $this->statsHandler->getPersisted()); |
| 323 |
|
} |
| 324 |
|
|
| 325 |
|
/** |
| 326 |
|
* @covers VDB\Spider\Spider::crawl |