@@ 281-296 (lines=16) @@ | ||
278 | /** |
|
279 | * @covers VDB\Spider\Spider |
|
280 | */ |
|
281 | public function testCrawlBFSMaxDepthOne() |
|
282 | { |
|
283 | $this->spider->getQueueManager()->setTraversalAlgorithm(InMemoryQueueManager::ALGORITHM_BREADTH_FIRST); |
|
284 | $this->spider->getDiscovererSet()->maxDepth = 1; |
|
285 | ||
286 | $this->spider->crawl(); |
|
287 | ||
288 | $expected = array( |
|
289 | $this->linkA, |
|
290 | $this->linkB, |
|
291 | $this->linkC, |
|
292 | $this->linkE, |
|
293 | ); |
|
294 | ||
295 | $this->compareUriArray($expected, $this->spider->getDownloader()->getPersistenceHandler()); |
|
296 | } |
|
297 | ||
298 | /** |
|
299 | * @covers VDB\Spider\Spider |
|
@@ 301-315 (lines=15) @@ | ||
298 | /** |
|
299 | * @covers VDB\Spider\Spider |
|
300 | */ |
|
301 | public function testCrawlDFSMaxQueueSize() |
|
302 | { |
|
303 | $this->spider->getDiscovererSet()->maxDepth = 1000; |
|
304 | $this->spider->getDownloader()->setDownloadLimit(3); |
|
305 | ||
306 | $this->spider->crawl(); |
|
307 | ||
308 | $expected = array( |
|
309 | $this->linkA, |
|
310 | $this->linkE, |
|
311 | $this->linkF, |
|
312 | ); |
|
313 | ||
314 | $this->compareUriArray($expected, $this->spider->getDownloader()->getPersistenceHandler()); |
|
315 | } |
|
316 | ||
317 | /** |
|
318 | * @covers VDB\Spider\Spider |
|
@@ 320-335 (lines=16) @@ | ||
317 | /** |
|
318 | * @covers VDB\Spider\Spider |
|
319 | */ |
|
320 | public function testCrawlBFSMaxQueueSize() |
|
321 | { |
|
322 | $this->spider->getQueueManager()->setTraversalAlgorithm(InMemoryQueueManager::ALGORITHM_BREADTH_FIRST); |
|
323 | $this->spider->getDiscovererSet()->maxDepth = 1000; |
|
324 | $this->spider->getDownloader()->setDownloadLimit(3); |
|
325 | ||
326 | $this->spider->crawl(); |
|
327 | ||
328 | $expected = array( |
|
329 | $this->linkA, |
|
330 | $this->linkB, |
|
331 | $this->linkC, |
|
332 | ); |
|
333 | ||
334 | $this->compareUriArray($expected, $this->spider->getDownloader()->getPersistenceHandler()); |
|
335 | } |
|
336 | ||
337 | /** |
|
338 | * @covers VDB\Spider\Spider |