@@ 193-210 (lines=18) @@ | ||
190 | * |
|
191 | * Behaviour as explained here: https://en.wikipedia.org/wiki/Depth-first_search#Example |
|
192 | */ |
|
193 | public function testCrawlDFSDefaultBehaviour() |
|
194 | { |
|
195 | $this->spider->getDiscovererSet()->maxDepth = 10; |
|
196 | ||
197 | $this->spider->crawl(); |
|
198 | ||
199 | $expected = array( |
|
200 | $this->linkA, |
|
201 | $this->linkE, |
|
202 | $this->linkF, |
|
203 | $this->linkC, |
|
204 | $this->linkG, |
|
205 | $this->linkB, |
|
206 | $this->linkD |
|
207 | ); |
|
208 | ||
209 | $this->assertEquals($expected, $this->statsHandler->getPersisted()); |
|
210 | } |
|
211 | ||
212 | /** |
|
213 | * @covers VDB\Spider\Spider::crawl |
|
@@ 216-234 (lines=19) @@ | ||
213 | * @covers VDB\Spider\Spider::crawl |
|
214 | * |
|
215 | */ |
|
216 | public function testCrawlBFSDefaultBehaviour() |
|
217 | { |
|
218 | $this->spider->getQueueManager()->setTraversalAlgorithm(InMemoryQueueManager::ALGORITHM_BREADTH_FIRST); |
|
219 | $this->spider->getDiscovererSet()->maxDepth = 1000; |
|
220 | ||
221 | $this->spider->crawl(); |
|
222 | ||
223 | $expected = array( |
|
224 | $this->linkA, |
|
225 | $this->linkB, |
|
226 | $this->linkC, |
|
227 | $this->linkE, |
|
228 | $this->linkD, |
|
229 | $this->linkF, |
|
230 | $this->linkG |
|
231 | ); |
|
232 | ||
233 | $this->assertEquals($expected, $this->statsHandler->getPersisted()); |
|
234 | } |
|
235 | ||
236 | /** |
|
237 | * @covers VDB\Spider\Spider::crawl |