39
39
*/
40
40
class tool_crawler_robot_crawler_test extends advanced_testcase {
41
41
42
+ /**
43
+ * Setup robot crawler testcase and parent setup
44
+ */
42
45
protected function setUp () {
43
46
parent ::setup ();
44
47
$ this ->resetAfterTest (true );
@@ -193,7 +196,7 @@ public function test_reset_queries() {
193
196
194
197
$ nodeid = $ persistent ->get ('id ' );
195
198
196
- // Record should exist
199
+ // Record should exist.
197
200
$ found = $ DB ->record_exists ('tool_crawler_url ' , ['id ' => $ nodeid ]);
198
201
self ::assertTrue ($ found );
199
202
@@ -349,6 +352,8 @@ public function priority_provider() {
349
352
* @dataProvider priority_provider
350
353
*
351
354
* Test for issue #108 - passing node crawl priority to child nodes when parsing html.
355
+ *
356
+ * @param int $parentpriority the priority of the parent queue item
352
357
*/
353
358
public function test_parse_html_priority_inheritance ($ parentpriority ) {
354
359
global $ CFG , $ DB ;
@@ -506,7 +511,7 @@ public function test_url_creates_hash() {
506
511
public function crawler_url_string_matches_provider () {
507
512
return [
508
513
['/index.php ' , '/index.php ' , true ],
509
- ['/some/dir/index.php ' , '/index.php ' , true ], // Different from core function
514
+ ['/some/dir/index.php ' , '/index.php ' , true ], // Different from core function.
510
515
['/course/view.php ' , '/course/view.php ' , true ],
511
516
['/view.php ' , '/course/view.php ' , false ],
512
517
['/mod/forum ' , '/mod/forum/* ' , false ],
@@ -519,14 +524,14 @@ public function crawler_url_string_matches_provider() {
519
524
['/mod/one/two/view.php ' , '*/view.php ' , true ],
520
525
['/foo.php ' , '/foo.php,/bar.php ' , true ],
521
526
['/bar.php ' , '/foo.php,/bar.php ' , true ],
522
- ['/foo/bar.php ' , "/foo.php,/bar.php " , true ], // Different from core function
527
+ ['/foo/bar.php ' , "/foo.php,/bar.php " , true ], // Different from core function.
523
528
['/foo/bar.php ' , "/foo.php,*/bar.php " , true ],
524
529
['/foo/bar.php ' , "/foo*.php,/bar.php " , true ],
525
- ['/foo.php ' , "/foo.php \n/bar.php " , false ], // Different from core function
526
- ['/bar.php ' , "/foo.php \n/bar.php " , false ], // Different from core function
530
+ ['/foo.php ' , "/foo.php \n/bar.php " , false ], // Different from core function.
531
+ ['/bar.php ' , "/foo.php \n/bar.php " , false ], // Different from core function.
527
532
['/foo/bar.php ' , "/foo.php \n/bar.php " , false ],
528
- ['/foo/bar.php ' , "/foo.php \n*/bar.php " , false ], // Different from core function
529
- ['/foo/bar.php ' , "/foo*.php \n/bar.php " , false ], // Different from core function
533
+ ['/foo/bar.php ' , "/foo.php \n*/bar.php " , false ], // Different from core function.
534
+ ['/foo/bar.php ' , "/foo*.php \n/bar.php " , false ], // Different from core function.
530
535
];
531
536
}
532
537
@@ -560,10 +565,11 @@ public function url_validity_check_provider() {
560
565
561
566
/**
562
567
* @dataProvider url_validity_check_provider
568
+ *
563
569
* Check url validity
564
570
*
565
- * @param $expected
566
- * @param $url
571
+ * @param string $url the url to test
572
+ * @param $expected the expected result
567
573
*/
568
574
public function test_invalid_url ($ url , $ expected ) {
569
575
$ baseurl = 'https://www.example.com/moodle ' ;
@@ -591,6 +597,9 @@ public function page_title_validity_check_provider() {
591
597
* @dataProvider page_title_validity_check_provider
592
598
*
593
599
* Test for Issue #143: invalid character in page title.
600
+ *
601
+ * @param $url the url to test
602
+ * @param $expected
594
603
*/
595
604
public function test_check_page_title_validity ($ node , $ expected ) {
596
605
$ this ->resetAfterTest (true );
0 commit comments