@@ 260-275 (lines=16) @@ | ||
257 | /** |
|
258 | * @covers VDB\Spider\Spider |
|
259 | */ |
|
260 | public function testCrawlBFSMaxDepthOne() |
|
261 | { |
|
262 | $this->spider->getQueueManager()->setTraversalAlgorithm(InMemoryQueueManager::ALGORITHM_BREADTH_FIRST); |
|
263 | $this->spider->getDiscovererSet()->maxDepth = 1; |
|
264 | ||
265 | $this->spider->crawl(); |
|
266 | ||
267 | $expected = array( |
|
268 | $this->linkA, |
|
269 | $this->linkB, |
|
270 | $this->linkC, |
|
271 | $this->linkE, |
|
272 | ); |
|
273 | ||
274 | $this->compareUriArray($expected, $this->spider->getDownloader()->getPersistenceHandler()); |
|
275 | } |
|
276 | ||
277 | /** |
|
278 | * @covers VDB\Spider\Spider |
|
@@ 280-294 (lines=15) @@ | ||
277 | /** |
|
278 | * @covers VDB\Spider\Spider |
|
279 | */ |
|
280 | public function testCrawlDFSMaxQueueSize() |
|
281 | { |
|
282 | $this->spider->getDiscovererSet()->maxDepth = 1000; |
|
283 | $this->spider->getDownloader()->setDownloadLimit(3); |
|
284 | ||
285 | $this->spider->crawl(); |
|
286 | ||
287 | $expected = array( |
|
288 | $this->linkA, |
|
289 | $this->linkE, |
|
290 | $this->linkF, |
|
291 | ); |
|
292 | ||
293 | $this->compareUriArray($expected, $this->spider->getDownloader()->getPersistenceHandler()); |
|
294 | } |
|
295 | ||
296 | /** |
|
297 | * @covers VDB\Spider\Spider |
|
@@ 299-314 (lines=16) @@ | ||
296 | /** |
|
297 | * @covers VDB\Spider\Spider |
|
298 | */ |
|
299 | public function testCrawlBFSMaxQueueSize() |
|
300 | { |
|
301 | $this->spider->getQueueManager()->setTraversalAlgorithm(InMemoryQueueManager::ALGORITHM_BREADTH_FIRST); |
|
302 | $this->spider->getDiscovererSet()->maxDepth = 1000; |
|
303 | $this->spider->getDownloader()->setDownloadLimit(3); |
|
304 | ||
305 | $this->spider->crawl(); |
|
306 | ||
307 | $expected = array( |
|
308 | $this->linkA, |
|
309 | $this->linkB, |
|
310 | $this->linkC, |
|
311 | ); |
|
312 | ||
313 | $this->compareUriArray($expected, $this->spider->getDownloader()->getPersistenceHandler()); |
|
314 | } |
|
315 | ||
316 | /** |
|
317 | * @covers VDB\Spider\Spider |