| @@ 258-272 (lines=15) @@ | ||
| 255 | /** |
|
| 256 | * @covers VDB\Spider\Spider::crawl |
|
| 257 | */ |
|
| 258 | public function testCrawlDFSMaxQueueSize() |
|
| 259 | { |
|
| 260 | $this->spider->getQueueManager()->maxDepth = 1000; |
|
| 261 | $this->spider->downloadLimit = 3; |
|
| 262 | ||
| 263 | $this->spider->crawl(); |
|
| 264 | ||
| 265 | $expected = array( |
|
| 266 | $this->linkA, |
|
| 267 | $this->linkE, |
|
| 268 | $this->linkF, |
|
| 269 | ); |
|
| 270 | ||
| 271 | $this->assertEquals($expected, $this->statsHandler->getPersisted()); |
|
| 272 | } |
|
| 273 | ||
| 274 | public function testCrawlBFSMaxQueueSize() |
|
| 275 | { |
|
| @@ 274-289 (lines=16) @@ | ||
| 271 | $this->assertEquals($expected, $this->statsHandler->getPersisted()); |
|
| 272 | } |
|
| 273 | ||
| 274 | public function testCrawlBFSMaxQueueSize() |
|
| 275 | { |
|
| 276 | $this->spider->getQueueManager()->setTraversalAlgorithm(InMemoryQueueManager::ALGORITHM_BREADTH_FIRST); |
|
| 277 | $this->spider->getQueueManager()->maxDepth = 1000; |
|
| 278 | $this->spider->downloadLimit = 3; |
|
| 279 | ||
| 280 | $this->spider->crawl(); |
|
| 281 | ||
| 282 | $expected = array( |
|
| 283 | $this->linkA, |
|
| 284 | $this->linkB, |
|
| 285 | $this->linkC, |
|
| 286 | ); |
|
| 287 | ||
| 288 | $this->assertEquals($expected, $this->statsHandler->getPersisted()); |
|
| 289 | } |
|
| 290 | ||
| 291 | /** |
|
| 292 | * @covers VDB\Spider\Spider::crawl |
|