Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 397... Línea 397...
397
    }
397
    }
Línea 398... Línea 398...
398
 
398
 
399
    /**
399
    /**
400
     * Test create_module() for multiple modules defined in the $modules array (first declaration of the function).
400
     * Test create_module() for multiple modules defined in the $modules array (first declaration of the function).
401
     */
401
     */
402
    public function test_create_module() {
402
    public function test_create_module(): void {
403
        // Add the module name you want to test here.
403
        // Add the module name you want to test here.
404
        // Create the match MODULENAME_create_set_values() and MODULENAME_create_run_asserts().
404
        // Create the match MODULENAME_create_set_values() and MODULENAME_create_run_asserts().
405
        $modules = array('forum', 'assign');
405
        $modules = array('forum', 'assign');
406
        // Run all tests.
406
        // Run all tests.
Línea 410... Línea 410...
410
    }
410
    }
Línea 411... Línea 411...
411
 
411
 
412
    /**
412
    /**
413
     * Test update_module() for multiple modules defined in the $modules array (first declaration of the function).
413
     * Test update_module() for multiple modules defined in the $modules array (first declaration of the function).
414
     */
414
     */
415
    public function test_update_module() {
415
    public function test_update_module(): void {
416
        // Add the module name you want to test here.
416
        // Add the module name you want to test here.
417
        // Create the match MODULENAME_update_set_values() and MODULENAME_update_run_asserts().
417
        // Create the match MODULENAME_update_set_values() and MODULENAME_update_run_asserts().
418
        $modules = array('forum');
418
        $modules = array('forum');
419
        // Run all tests.
419
        // Run all tests.
Línea 647... Línea 647...
647
    }
647
    }
Línea 648... Línea 648...
648
 
648
 
649
    /**
649
    /**
650
     * Test the create_course function
650
     * Test the create_course function
651
     */
651
     */
652
    public function test_create_course() {
652
    public function test_create_course(): void {
653
        global $DB;
653
        global $DB;
654
        $this->resetAfterTest(true);
654
        $this->resetAfterTest(true);
Línea 655... Línea 655...
655
        $defaultcategory = $DB->get_field_select('course_categories', "MIN(id)", "parent=0");
655
        $defaultcategory = $DB->get_field_select('course_categories', "MIN(id)", "parent=0");
Línea 691... Línea 691...
691
        } catch (moodle_exception $e) {
691
        } catch (moodle_exception $e) {
692
            $this->assertSame(get_string('courseidnumbertaken', 'error', $course->idnumber), $e->getMessage());
692
            $this->assertSame(get_string('courseidnumbertaken', 'error', $course->idnumber), $e->getMessage());
693
        }
693
        }
694
    }
694
    }
Línea 695... Línea 695...
695
 
695
 
696
    public function test_create_course_with_generator() {
696
    public function test_create_course_with_generator(): void {
697
        global $DB;
697
        global $DB;
698
        $this->resetAfterTest(true);
698
        $this->resetAfterTest(true);
Línea 699... Línea 699...
699
        $course = $this->getDataGenerator()->create_course();
699
        $course = $this->getDataGenerator()->create_course();
700
 
700
 
701
        // Ensure default section is created.
701
        // Ensure default section is created.
702
        $sectioncreated = $DB->record_exists('course_sections', array('course' => $course->id, 'section' => 0));
702
        $sectioncreated = $DB->record_exists('course_sections', array('course' => $course->id, 'section' => 0));
Línea 703... Línea 703...
703
        $this->assertTrue($sectioncreated);
703
        $this->assertTrue($sectioncreated);
704
    }
704
    }
705
 
705
 
Línea 706... Línea 706...
706
    public function test_create_course_sections() {
706
    public function test_create_course_sections(): void {
707
        global $DB;
707
        global $DB;
Línea 727... Línea 727...
727
        // Ensure all 7 (0-6) sections were created and modinfo/sectioninfo cache works properly
727
        // Ensure all 7 (0-6) sections were created and modinfo/sectioninfo cache works properly
728
        $sectionscreated = array_keys(get_fast_modinfo($course)->get_section_info_all());
728
        $sectionscreated = array_keys(get_fast_modinfo($course)->get_section_info_all());
729
        $this->assertEquals(range(0, $numsections + 1), $sectionscreated);
729
        $this->assertEquals(range(0, $numsections + 1), $sectionscreated);
730
    }
730
    }
Línea 731... Línea 731...
731
 
731
 
732
    public function test_update_course() {
732
    public function test_update_course(): void {
Línea 733... Línea 733...
733
        global $DB;
733
        global $DB;
Línea 734... Línea 734...
734
 
734
 
Línea 774... Línea 774...
774
        } catch (moodle_exception $e) {
774
        } catch (moodle_exception $e) {
775
            $this->assertEquals(get_string('shortnametaken', 'error', $created2->shortname), $e->getMessage());
775
            $this->assertEquals(get_string('shortnametaken', 'error', $created2->shortname), $e->getMessage());
776
        }
776
        }
777
    }
777
    }
Línea 778... Línea 778...
778
 
778
 
779
    public function test_update_course_section_time_modified() {
779
    public function test_update_course_section_time_modified(): void {
Línea 780... Línea 780...
780
        global $DB;
780
        global $DB;
Línea 781... Línea 781...
781
 
781
 
Línea 825... Línea 825...
825
     * @dataProvider create_course_relative_dates_provider
825
     * @dataProvider create_course_relative_dates_provider
826
     * @param int $setting The value for the 'enablecourserelativedates' admin setting.
826
     * @param int $setting The value for the 'enablecourserelativedates' admin setting.
827
     * @param int $mode The value for the course's 'relativedatesmode' field.
827
     * @param int $mode The value for the course's 'relativedatesmode' field.
828
     * @param int $expectedvalue The expected value of the 'relativedatesmode' field after course creation.
828
     * @param int $expectedvalue The expected value of the 'relativedatesmode' field after course creation.
829
     */
829
     */
830
    public function test_relative_dates_mode_for_course_creation($setting, $mode, $expectedvalue) {
830
    public function test_relative_dates_mode_for_course_creation($setting, $mode, $expectedvalue): void {
831
        global $DB;
831
        global $DB;
Línea 832... Línea 832...
832
 
832
 
Línea 833... Línea 833...
833
        $this->resetAfterTest();
833
        $this->resetAfterTest();
Línea 843... Línea 843...
843
    }
843
    }
Línea 844... Línea 844...
844
 
844
 
845
    /**
845
    /**
846
     * Test update_course by attempting to change the relative dates mode.
846
     * Test update_course by attempting to change the relative dates mode.
847
     */
847
     */
848
    public function test_relative_dates_mode_for_course_update() {
848
    public function test_relative_dates_mode_for_course_update(): void {
Línea 849... Línea 849...
849
        global $DB;
849
        global $DB;
Línea 850... Línea 850...
850
 
850
 
Línea 862... Línea 862...
862
        // Verify that the relative dates mode has not changed.
862
        // Verify that the relative dates mode has not changed.
863
        $relativedatesmode = $DB->get_field('course', 'relativedatesmode', ['id' => $course->id]);
863
        $relativedatesmode = $DB->get_field('course', 'relativedatesmode', ['id' => $course->id]);
864
        $this->assertEquals(1, $relativedatesmode);
864
        $this->assertEquals(1, $relativedatesmode);
865
    }
865
    }
Línea 866... Línea 866...
866
 
866
 
867
    public function test_course_add_cm_to_section() {
867
    public function test_course_add_cm_to_section(): void {
868
        global $DB;
868
        global $DB;
Línea 869... Línea 869...
869
        $this->resetAfterTest(true);
869
        $this->resetAfterTest(true);
870
 
870
 
Línea 913... Línea 913...
913
        $this->assertEquals(3, $DB->count_records('course_sections', array('course' => $course->id)));
913
        $this->assertEquals(3, $DB->count_records('course_sections', array('course' => $course->id)));
914
        $sequence = $DB->get_field('course_sections', 'sequence', array('course' => $course->id, 'section' => 2));
914
        $sequence = $DB->get_field('course_sections', 'sequence', array('course' => $course->id, 'section' => 2));
915
        $this->assertEquals($cmids[3] . ',' . $cmids[2], $sequence);
915
        $this->assertEquals($cmids[3] . ',' . $cmids[2], $sequence);
916
    }
916
    }
Línea 917... Línea 917...
917
 
917
 
918
    public function test_reorder_sections() {
918
    public function test_reorder_sections(): void {
919
        global $DB;
919
        global $DB;
Línea 920... Línea 920...
920
        $this->resetAfterTest(true);
920
        $this->resetAfterTest(true);
921
 
921
 
Línea 951... Línea 951...
951
 
951
 
952
        $neworder = reorder_sections(1, 2, 4);
952
        $neworder = reorder_sections(1, 2, 4);
953
        $this->assertFalse($neworder);
953
        $this->assertFalse($neworder);
Línea 954... Línea 954...
954
    }
954
    }
955
 
955
 
956
    public function test_move_section_down() {
956
    public function test_move_section_down(): void {
Línea 957... Línea 957...
957
        global $DB;
957
        global $DB;
958
        $this->resetAfterTest(true);
958
        $this->resetAfterTest(true);
Línea 980... Línea 980...
980
        $this->assertEquals($oldsections[4], $sections[3]);
980
        $this->assertEquals($oldsections[4], $sections[3]);
981
        $this->assertEquals($oldsections[5], $sections[5]);
981
        $this->assertEquals($oldsections[5], $sections[5]);
982
        $this->assertEquals($oldsections[6], $sections[6]);
982
        $this->assertEquals($oldsections[6], $sections[6]);
983
    }
983
    }
Línea 984... Línea 984...
984
 
984
 
985
    public function test_move_section_up() {
985
    public function test_move_section_up(): void {
986
        global $DB;
986
        global $DB;
Línea 987... Línea 987...
987
        $this->resetAfterTest(true);
987
        $this->resetAfterTest(true);
988
 
988
 
Línea 1009... Línea 1009...
1009
        $this->assertEquals($oldsections[4], $sections[5]);
1009
        $this->assertEquals($oldsections[4], $sections[5]);
1010
        $this->assertEquals($oldsections[5], $sections[6]);
1010
        $this->assertEquals($oldsections[5], $sections[6]);
1011
        $this->assertEquals($oldsections[6], $sections[4]);
1011
        $this->assertEquals($oldsections[6], $sections[4]);
1012
    }
1012
    }
Línea 1013... Línea 1013...
1013
 
1013
 
1014
    public function test_move_section_marker() {
1014
    public function test_move_section_marker(): void {
1015
        global $DB;
1015
        global $DB;
Línea 1016... Línea 1016...
1016
        $this->resetAfterTest(true);
1016
        $this->resetAfterTest(true);
1017
 
1017
 
Línea 1127... Línea 1127...
1127
        // So the queries will be doubled. See: course/lib.php:1423
1127
        // So the queries will be doubled. See: course/lib.php:1423
1128
        // Make sure that we only need 4 queries to update the position of section 2 and section 3.
1128
        // Make sure that we only need 4 queries to update the position of section 2 and section 3.
1129
        $this->assertEquals(4, $sectionmovequerycount);
1129
        $this->assertEquals(4, $sectionmovequerycount);
1130
    }
1130
    }
Línea 1131... Línea 1131...
1131
 
1131
 
1132
    public function test_course_can_delete_section() {
1132
    public function test_course_can_delete_section(): void {
1133
        global $DB;
1133
        global $DB;
Línea 1134... Línea 1134...
1134
        $this->resetAfterTest(true);
1134
        $this->resetAfterTest(true);
Línea 1189... Línea 1189...
1189
        $this->assertFalse(course_can_delete_section($courseweeks, 1));
1189
        $this->assertFalse(course_can_delete_section($courseweeks, 1));
1190
        $this->assertFalse(course_can_delete_section($coursetopics, 1));
1190
        $this->assertFalse(course_can_delete_section($coursetopics, 1));
1191
        $this->assertFalse(course_can_delete_section($coursesingleactivity, 1));
1191
        $this->assertFalse(course_can_delete_section($coursesingleactivity, 1));
1192
    }
1192
    }
Línea 1193... Línea 1193...
1193
 
1193
 
1194
    public function test_course_delete_section() {
1194
    public function test_course_delete_section(): void {
1195
        global $DB;
1195
        global $DB;
Línea 1196... Línea 1196...
1196
        $this->resetAfterTest(true);
1196
        $this->resetAfterTest(true);
Línea 1243... Línea 1243...
1243
        $this->assertTrue(course_get_format($course)->is_section_current(1));
1243
        $this->assertTrue(course_get_format($course)->is_section_current(1));
1244
        $this->assertTrue(course_delete_section($course, 1, true));
1244
        $this->assertTrue(course_delete_section($course, 1, true));
1245
        $this->assertFalse(course_get_format($course)->is_section_current(1));
1245
        $this->assertFalse(course_get_format($course)->is_section_current(1));
1246
    }
1246
    }
Línea 1247... Línea 1247...
1247
 
1247
 
1248
    public function test_get_course_display_name_for_list() {
1248
    public function test_get_course_display_name_for_list(): void {
1249
        global $CFG;
1249
        global $CFG;
Línea 1250... Línea 1250...
1250
        $this->resetAfterTest(true);
1250
        $this->resetAfterTest(true);
Línea 1256... Línea 1256...
1256
 
1256
 
1257
        $CFG->courselistshortnames = 1;
1257
        $CFG->courselistshortnames = 1;
1258
        $this->assertEquals('FROG101 Introduction to pond life', get_course_display_name_for_list($course));
1258
        $this->assertEquals('FROG101 Introduction to pond life', get_course_display_name_for_list($course));
Línea 1259... Línea 1259...
1259
    }
1259
    }
1260
 
1260
 
Línea 1261... Línea 1261...
1261
    public function test_move_module_in_course() {
1261
    public function test_move_module_in_course(): void {
1262
        global $DB;
1262
        global $DB;
1263
 
1263
 
Línea 1319... Línea 1319...
1319
        $newsection = $DB->get_record('course_sections', array('id' => $newsection->id));
1319
        $newsection = $DB->get_record('course_sections', array('id' => $newsection->id));
1320
        $newsequences = explode(',', $newsection->sequence);
1320
        $newsequences = explode(',', $newsection->sequence);
1321
        $this->assertTrue(in_array($cm->id, $newsequences));
1321
        $this->assertTrue(in_array($cm->id, $newsequences));
1322
    }
1322
    }
Línea 1323... Línea 1323...
1323
 
1323
 
1324
    public function test_module_visibility() {
1324
    public function test_module_visibility(): void {
1325
        $this->setAdminUser();
1325
        $this->setAdminUser();
Línea 1326... Línea 1326...
1326
        $this->resetAfterTest(true);
1326
        $this->resetAfterTest(true);
1327
 
1327
 
Línea 1389... Línea 1389...
1389
        foreach ($modules as $mod) {
1389
        foreach ($modules as $mod) {
1390
            $this->check_module_visibility($mod, 1, 1);
1390
            $this->check_module_visibility($mod, 1, 1);
1391
        }
1391
        }
1392
    }
1392
    }
Línea 1393... Línea 1393...
1393
 
1393
 
1394
    public function test_section_visibility_events() {
1394
    public function test_section_visibility_events(): void {
1395
        $this->setAdminUser();
1395
        $this->setAdminUser();
Línea 1396... Línea 1396...
1396
        $this->resetAfterTest(true);
1396
        $this->resetAfterTest(true);
1397
 
1397
 
Línea 1415... Línea 1415...
1415
        }
1415
        }
1416
        $this->assertSame(2, $count);
1416
        $this->assertSame(2, $count);
1417
        $sink->close();
1417
        $sink->close();
1418
    }
1418
    }
Línea 1419... Línea 1419...
1419
 
1419
 
1420
    public function test_section_visibility() {
1420
    public function test_section_visibility(): void {
1421
        $this->setAdminUser();
1421
        $this->setAdminUser();
Línea 1422... Línea 1422...
1422
        $this->resetAfterTest(true);
1422
        $this->resetAfterTest(true);
1423
 
1423
 
Línea 1519... Línea 1519...
1519
                $this->assertEquals($visibility, $calevent->visible, "$cm->modname calendar_event visibility");
1519
                $this->assertEquals($visibility, $calevent->visible, "$cm->modname calendar_event visibility");
1520
            }
1520
            }
1521
        }
1521
        }
1522
    }
1522
    }
Línea 1523... Línea 1523...
1523
 
1523
 
1524
    public function test_course_page_type_list() {
1524
    public function test_course_page_type_list(): void {
1525
        global $DB;
1525
        global $DB;
Línea 1526... Línea 1526...
1526
        $this->resetAfterTest(true);
1526
        $this->resetAfterTest(true);
1527
 
1527
 
Línea 1571... Línea 1571...
1571
        // Calls made from generate_page_type_patterns() may provide null values.
1571
        // Calls made from generate_page_type_patterns() may provide null values.
1572
        $pagetypelist = course_page_type_list($pagetype, null, null);
1572
        $pagetypelist = course_page_type_list($pagetype, null, null);
1573
        $this->assertEquals($pagetypelist, $testpagetypelist1);
1573
        $this->assertEquals($pagetypelist, $testpagetypelist1);
1574
    }
1574
    }
Línea 1575... Línea 1575...
1575
 
1575
 
Línea 1576... Línea 1576...
1576
    public function test_compare_activities_by_time_desc() {
1576
    public function test_compare_activities_by_time_desc(): void {
1577
 
1577
 
1578
        // Let's create some test data.
1578
        // Let's create some test data.
1579
        $activitiesivities = array();
1579
        $activitiesivities = array();
Línea 1615... Línea 1615...
1615
            }
1615
            }
1616
            $this->assertLessThanOrEqual($last, $activity->timestamp);
1616
            $this->assertLessThanOrEqual($last, $activity->timestamp);
1617
        }
1617
        }
1618
    }
1618
    }
Línea 1619... Línea 1619...
1619
 
1619
 
Línea 1620... Línea 1620...
1620
    public function test_compare_activities_by_time_asc() {
1620
    public function test_compare_activities_by_time_asc(): void {
1621
 
1621
 
1622
        // Let's create some test data.
1622
        // Let's create some test data.
1623
        $activities = array();
1623
        $activities = array();
Línea 1664... Línea 1664...
1664
    /**
1664
    /**
1665
     * Tests moving a module between hidden/visible sections and
1665
     * Tests moving a module between hidden/visible sections and
1666
     * verifies that the course/module visiblity seettings are
1666
     * verifies that the course/module visiblity seettings are
1667
     * retained.
1667
     * retained.
1668
     */
1668
     */
1669
    public function test_moveto_module_between_hidden_sections() {
1669
    public function test_moveto_module_between_hidden_sections(): void {
1670
        global $DB;
1670
        global $DB;
Línea 1671... Línea 1671...
1671
 
1671
 
Línea 1672... Línea 1672...
1672
        $this->resetAfterTest(true);
1672
        $this->resetAfterTest(true);
Línea 1746... Línea 1746...
1746
 
1746
 
1747
    /**
1747
    /**
1748
     * Tests moving a module around in the same section. moveto_module()
1748
     * Tests moving a module around in the same section. moveto_module()
1749
     * is called this way in modduplicate.
1749
     * is called this way in modduplicate.
1750
     */
1750
     */
1751
    public function test_moveto_module_in_same_section() {
1751
    public function test_moveto_module_in_same_section(): void {
Línea 1752... Línea 1752...
1752
        global $DB;
1752
        global $DB;
Línea 1753... Línea 1753...
1753
 
1753
 
Línea 1790... Línea 1790...
1790
     *
1790
     *
1791
     * @param string $type The type of module for the test
1791
     * @param string $type The type of module for the test
1792
     * @param array $options The options for the module creation
1792
     * @param array $options The options for the module creation
1793
     * @dataProvider provider_course_delete_module
1793
     * @dataProvider provider_course_delete_module
1794
     */
1794
     */
1795
    public function test_course_delete_module($type, $options) {
1795
    public function test_course_delete_module($type, $options): void {
1796
        global $DB;
1796
        global $DB;
Línea 1797... Línea 1797...
1797
 
1797
 
1798
        $this->resetAfterTest(true);
1798
        $this->resetAfterTest(true);
Línea 1897... Línea 1897...
1897
    }
1897
    }
Línea 1898... Línea 1898...
1898
 
1898
 
1899
    /**
1899
    /**
1900
     * Test that triggering a course_created event works as expected.
1900
     * Test that triggering a course_created event works as expected.
1901
     */
1901
     */
1902
    public function test_course_created_event() {
1902
    public function test_course_created_event(): void {
Línea 1903... Línea 1903...
1903
        global $DB;
1903
        global $DB;
Línea 1904... Línea 1904...
1904
 
1904
 
Línea 1962... Línea 1962...
1962
    }
1962
    }
Línea 1963... Línea 1963...
1963
 
1963
 
1964
    /**
1964
    /**
1965
     * Test that triggering a course_updated event works as expected.
1965
     * Test that triggering a course_updated event works as expected.
1966
     */
1966
     */
1967
    public function test_course_updated_event() {
1967
    public function test_course_updated_event(): void {
Línea 1968... Línea 1968...
1968
        global $DB;
1968
        global $DB;
Línea 1969... Línea 1969...
1969
 
1969
 
Línea 2031... Línea 2031...
2031
    }
2031
    }
Línea 2032... Línea 2032...
2032
 
2032
 
2033
    /**
2033
    /**
2034
     * Test that triggering a course_updated event logs changes.
2034
     * Test that triggering a course_updated event logs changes.
2035
     */
2035
     */
2036
    public function test_course_updated_event_with_changes() {
2036
    public function test_course_updated_event_with_changes(): void {
Línea 2037... Línea 2037...
2037
        global $DB;
2037
        global $DB;
Línea 2038... Línea 2038...
2038
 
2038
 
Línea 2064... Línea 2064...
2064
    }
2064
    }
Línea 2065... Línea 2065...
2065
 
2065
 
2066
    /**
2066
    /**
2067
     * Test that triggering a course_deleted event works as expected.
2067
     * Test that triggering a course_deleted event works as expected.
2068
     */
2068
     */
2069
    public function test_course_deleted_event() {
2069
    public function test_course_deleted_event(): void {
Línea 2070... Línea 2070...
2070
        $this->resetAfterTest();
2070
        $this->resetAfterTest();
2071
 
2071
 
Línea 2105... Línea 2105...
2105
    }
2105
    }
Línea 2106... Línea 2106...
2106
 
2106
 
2107
    /**
2107
    /**
2108
     * Test that triggering a course_content_deleted event works as expected.
2108
     * Test that triggering a course_content_deleted event works as expected.
2109
     */
2109
     */
2110
    public function test_course_content_deleted_event() {
2110
    public function test_course_content_deleted_event(): void {
Línea 2111... Línea 2111...
2111
        global $DB;
2111
        global $DB;
Línea 2112... Línea 2112...
2112
 
2112
 
Línea 2142... Línea 2142...
2142
    }
2142
    }
Línea 2143... Línea 2143...
2143
 
2143
 
2144
    /**
2144
    /**
2145
     * Test that triggering a course_category_deleted event works as expected.
2145
     * Test that triggering a course_category_deleted event works as expected.
2146
     */
2146
     */
2147
    public function test_course_category_deleted_event() {
2147
    public function test_course_category_deleted_event(): void {
Línea 2148... Línea 2148...
2148
        $this->resetAfterTest();
2148
        $this->resetAfterTest();
2149
 
2149
 
Línea 2209... Línea 2209...
2209
    }
2209
    }
Línea 2210... Línea 2210...
2210
 
2210
 
2211
    /**
2211
    /**
2212
     * Test that triggering a course_backup_created event works as expected.
2212
     * Test that triggering a course_backup_created event works as expected.
2213
     */
2213
     */
2214
    public function test_course_backup_created_event() {
2214
    public function test_course_backup_created_event(): void {
Línea 2215... Línea 2215...
2215
        global $CFG;
2215
        global $CFG;
2216
 
2216
 
2217
        // Get the necessary files to perform backup and restore.
2217
        // Get the necessary files to perform backup and restore.
Línea 2255... Línea 2255...
2255
    }
2255
    }
Línea 2256... Línea 2256...
2256
 
2256
 
2257
    /**
2257
    /**
2258
     * Test that triggering a course_restored event works as expected.
2258
     * Test that triggering a course_restored event works as expected.
2259
     */
2259
     */
2260
    public function test_course_restored_event() {
2260
    public function test_course_restored_event(): void {
Línea 2261... Línea 2261...
2261
        global $CFG;
2261
        global $CFG;
2262
 
2262
 
2263
        // Get the necessary files to perform backup and restore.
2263
        // Get the necessary files to perform backup and restore.
Línea 2312... Línea 2312...
2312
    }
2312
    }
Línea 2313... Línea 2313...
2313
 
2313
 
2314
    /**
2314
    /**
2315
     * Test that triggering a course_section_updated event works as expected.
2315
     * Test that triggering a course_section_updated event works as expected.
2316
     */
2316
     */
2317
    public function test_course_section_updated_event() {
2317
    public function test_course_section_updated_event(): void {
Línea 2318... Línea 2318...
2318
        global $DB;
2318
        global $DB;
Línea 2319... Línea 2319...
2319
 
2319
 
Línea 2367... Línea 2367...
2367
    }
2367
    }
Línea 2368... Línea 2368...
2368
 
2368
 
2369
    /**
2369
    /**
2370
     * Test that triggering a course_section_deleted event works as expected.
2370
     * Test that triggering a course_section_deleted event works as expected.
2371
     */
2371
     */
2372
    public function test_course_section_deleted_event() {
2372
    public function test_course_section_deleted_event(): void {
2373
        global $USER, $DB;
2373
        global $USER, $DB;
2374
        $this->resetAfterTest();
2374
        $this->resetAfterTest();
Línea 2375... Línea 2375...
2375
        $sink = $this->redirectEvents();
2375
        $sink = $this->redirectEvents();
Línea 2397... Línea 2397...
2397
        $this->assertEquals($section, $event->get_record_snapshot('course_sections', $event->objectid));
2397
        $this->assertEquals($section, $event->get_record_snapshot('course_sections', $event->objectid));
2398
        $this->assertNull($event->get_url());
2398
        $this->assertNull($event->get_url());
2399
        $this->assertEventContextNotUsed($event);
2399
        $this->assertEventContextNotUsed($event);
2400
    }
2400
    }
Línea 2401... Línea 2401...
2401
 
2401
 
2402
    public function test_course_integrity_check() {
2402
    public function test_course_integrity_check(): void {
Línea 2403... Línea 2403...
2403
        global $DB;
2403
        global $DB;
2404
 
2404
 
2405
        $this->resetAfterTest(true);
2405
        $this->resetAfterTest(true);
Línea 2520... Línea 2520...
2520
    }
2520
    }
Línea 2521... Línea 2521...
2521
 
2521
 
2522
    /**
2522
    /**
2523
     * Tests for event related to course module creation.
2523
     * Tests for event related to course module creation.
2524
     */
2524
     */
2525
    public function test_course_module_created_event() {
2525
    public function test_course_module_created_event(): void {
Línea 2526... Línea 2526...
2526
        global $USER;
2526
        global $USER;
2527
 
2527
 
Línea 2578... Línea 2578...
2578
    }
2578
    }
Línea 2579... Línea 2579...
2579
 
2579
 
2580
    /**
2580
    /**
2581
     * Tests for event validations related to course module creation.
2581
     * Tests for event validations related to course module creation.
2582
     */
2582
     */
Línea 2583... Línea 2583...
2583
    public function test_course_module_created_event_exceptions() {
2583
    public function test_course_module_created_event_exceptions(): void {
Línea 2584... Línea 2584...
2584
 
2584
 
2585
        $this->resetAfterTest();
2585
        $this->resetAfterTest();
Línea 2643... Línea 2643...
2643
    }
2643
    }
Línea 2644... Línea 2644...
2644
 
2644
 
2645
    /**
2645
    /**
2646
     * Tests for event related to course module updates.
2646
     * Tests for event related to course module updates.
2647
     */
2647
     */
2648
    public function test_course_module_updated_event() {
2648
    public function test_course_module_updated_event(): void {
2649
        global $USER, $DB;
2649
        global $USER, $DB;
Línea 2650... Línea 2650...
2650
        $this->resetAfterTest();
2650
        $this->resetAfterTest();
2651
 
2651
 
Línea 2678... Línea 2678...
2678
    }
2678
    }
Línea 2679... Línea 2679...
2679
 
2679
 
2680
    /**
2680
    /**
2681
     * Tests for create_from_cm method.
2681
     * Tests for create_from_cm method.
2682
     */
2682
     */
2683
    public function test_course_module_create_from_cm() {
2683
    public function test_course_module_create_from_cm(): void {
2684
        $this->resetAfterTest();
2684
        $this->resetAfterTest();
Línea 2685... Línea 2685...
2685
        $this->setAdminUser();
2685
        $this->setAdminUser();
2686
 
2686
 
Línea 2716... Línea 2716...
2716
    }
2716
    }
Línea 2717... Línea 2717...
2717
 
2717
 
2718
    /**
2718
    /**
2719
     * Tests for event validations related to course module update.
2719
     * Tests for event validations related to course module update.
2720
     */
2720
     */
Línea 2721... Línea 2721...
2721
    public function test_course_module_updated_event_exceptions() {
2721
    public function test_course_module_updated_event_exceptions(): void {
Línea 2722... Línea 2722...
2722
 
2722
 
2723
        $this->resetAfterTest();
2723
        $this->resetAfterTest();
Línea 2781... Línea 2781...
2781
    }
2781
    }
Línea 2782... Línea 2782...
2782
 
2782
 
2783
    /**
2783
    /**
2784
     * Tests for event related to course module delete.
2784
     * Tests for event related to course module delete.
2785
     */
2785
     */
2786
    public function test_course_module_deleted_event() {
2786
    public function test_course_module_deleted_event(): void {
2787
        global $USER, $DB;
2787
        global $USER, $DB;
Línea 2788... Línea 2788...
2788
        $this->resetAfterTest();
2788
        $this->resetAfterTest();
2789
 
2789
 
Línea 2806... Línea 2806...
2806
    }
2806
    }
Línea 2807... Línea 2807...
2807
 
2807
 
2808
    /**
2808
    /**
2809
     * Tests for event validations related to course module deletion.
2809
     * Tests for event validations related to course module deletion.
2810
     */
2810
     */
Línea 2811... Línea 2811...
2811
    public function test_course_module_deleted_event_exceptions() {
2811
    public function test_course_module_deleted_event_exceptions(): void {
Línea 2812... Línea 2812...
2812
 
2812
 
2813
        $this->resetAfterTest();
2813
        $this->resetAfterTest();
Línea 2876... Línea 2876...
2876
    }
2876
    }
Línea 2877... Línea 2877...
2877
 
2877
 
2878
    /**
2878
    /**
2879
     * Test course move after course.
2879
     * Test course move after course.
2880
     */
2880
     */
2881
    public function test_course_change_sortorder_after_course() {
2881
    public function test_course_change_sortorder_after_course(): void {
Línea 2882... Línea 2882...
2882
        global $DB;
2882
        global $DB;
Línea 2883... Línea 2883...
2883
 
2883
 
Línea 2925... Línea 2925...
2925
    }
2925
    }
Línea 2926... Línea 2926...
2926
 
2926
 
2927
    /**
2927
    /**
2928
     * Tests changing the visibility of a course.
2928
     * Tests changing the visibility of a course.
2929
     */
2929
     */
2930
    public function test_course_change_visibility() {
2930
    public function test_course_change_visibility(): void {
Línea 2931... Línea 2931...
2931
        global $DB;
2931
        global $DB;
Línea 2932... Línea 2932...
2932
 
2932
 
Línea 2951... Línea 2951...
2951
    }
2951
    }
Línea 2952... Línea 2952...
2952
 
2952
 
2953
    /**
2953
    /**
2954
     * Tests moving the course up and down by one.
2954
     * Tests moving the course up and down by one.
2955
     */
2955
     */
2956
    public function test_course_change_sortorder_by_one() {
2956
    public function test_course_change_sortorder_by_one(): void {
Línea 2957... Línea 2957...
2957
        global $DB;
2957
        global $DB;
Línea 2958... Línea 2958...
2958
 
2958
 
Línea 3007... Línea 3007...
3007
        $this->assertEquals(array($course1->id, $course2->id, $course3->id), array_keys($courses));
3007
        $this->assertEquals(array($course1->id, $course2->id, $course3->id), array_keys($courses));
3008
        $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
3008
        $dbcourses = $DB->get_records('course', array('category' => $category->id), 'sortorder', 'id');
3009
        $this->assertEquals(array_keys($dbcourses), array_keys($courses));
3009
        $this->assertEquals(array_keys($dbcourses), array_keys($courses));
3010
    }
3010
    }
Línea 3011... Línea 3011...
3011
 
3011
 
3012
    public function test_view_resources_list() {
3012
    public function test_view_resources_list(): void {
Línea 3013... Línea 3013...
3013
        $this->resetAfterTest();
3013
        $this->resetAfterTest();
3014
 
3014
 
Línea 3032... Línea 3032...
3032
    }
3032
    }
Línea 3033... Línea 3033...
3033
 
3033
 
3034
    /**
3034
    /**
3035
     * Test duplicate_module()
3035
     * Test duplicate_module()
3036
     */
3036
     */
3037
    public function test_duplicate_module() {
3037
    public function test_duplicate_module(): void {
3038
        $this->setAdminUser();
3038
        $this->setAdminUser();
3039
        $this->resetAfterTest();
3039
        $this->resetAfterTest();
3040
        $course = self::getDataGenerator()->create_course();
3040
        $course = self::getDataGenerator()->create_course();
3041
        $res = self::getDataGenerator()->create_module('resource', array('course' => $course));
3041
        $res = self::getDataGenerator()->create_module('resource', array('course' => $course));
Línea 3056... Línea 3056...
3056
            $this->assertEquals($value, $newcm->$prop);
3056
            $this->assertEquals($value, $newcm->$prop);
3057
        }
3057
        }
3058
    }
3058
    }
Línea 3059... Línea 3059...
3059
 
3059
 
-
 
3060
    /**
-
 
3061
     * Test that permissions are duplicated correctly after duplicate_module().
-
 
3062
     * @covers ::duplicate_module
-
 
3063
     * @return void
-
 
3064
     */
-
 
3065
    public function test_duplicate_module_permissions(): void {
-
 
3066
        global $DB;
-
 
3067
        $this->setAdminUser();
-
 
3068
        $this->resetAfterTest();
-
 
3069
 
-
 
3070
        // Create course and course module.
-
 
3071
        $course = self::getDataGenerator()->create_course();
-
 
3072
        $res = self::getDataGenerator()->create_module('assign', ['course' => $course]);
-
 
3073
        $cm = get_coursemodule_from_id('assign', $res->cmid, 0, false, MUST_EXIST);
-
 
3074
        $cmcontext = \context_module::instance($cm->id);
-
 
3075
 
-
 
3076
        // Enrol student user.
-
 
3077
        $user = self::getDataGenerator()->create_user();
-
 
3078
        $roleid = $DB->get_field('role', 'id', ['shortname' => 'student'], MUST_EXIST);
-
 
3079
        self::getDataGenerator()->enrol_user($user->id, $course->id, $roleid);
-
 
3080
 
-
 
3081
        // Add capability to original course module.
-
 
3082
        assign_capability('gradereport/grader:view', CAP_ALLOW, $roleid, $cmcontext->id);
-
 
3083
 
-
 
3084
        // Duplicate module.
-
 
3085
        $newcm = duplicate_module($course, $cm);
-
 
3086
        $newcmcontext = \context_module::instance($newcm->id);
-
 
3087
 
-
 
3088
        // Assert that user still has capability.
-
 
3089
        $this->assertTrue(has_capability('gradereport/grader:view', $newcmcontext, $user));
-
 
3090
 
-
 
3091
        // Assert that both modules contain the same count of overrides.
-
 
3092
        $overrides = $DB->get_records('role_capabilities', ['contextid' => $cmcontext->id]);
-
 
3093
        $newoverrides = $DB->get_records('role_capabilities', ['contextid' => $newcmcontext->id]);
-
 
3094
        $this->assertEquals(count($overrides), count($newoverrides));
-
 
3095
    }
-
 
3096
 
-
 
3097
    /**
-
 
3098
     * Test that locally assigned roles are duplicated correctly after duplicate_module().
-
 
3099
     * @covers ::duplicate_module
-
 
3100
     * @return void
-
 
3101
     */
-
 
3102
    public function test_duplicate_module_role_assignments(): void {
-
 
3103
        global $DB;
-
 
3104
        $this->setAdminUser();
-
 
3105
        $this->resetAfterTest();
-
 
3106
 
-
 
3107
        // Create course and course module.
-
 
3108
        $course = self::getDataGenerator()->create_course();
-
 
3109
        $res = self::getDataGenerator()->create_module('assign', ['course' => $course]);
-
 
3110
        $cm = get_coursemodule_from_id('assign', $res->cmid, 0, false, MUST_EXIST);
-
 
3111
        $cmcontext = \context_module::instance($cm->id);
-
 
3112
 
-
 
3113
        // Enrol student user.
-
 
3114
        $user = self::getDataGenerator()->create_user();
-
 
3115
        $roleid = $DB->get_field('role', 'id', ['shortname' => 'student'], MUST_EXIST);
-
 
3116
        self::getDataGenerator()->enrol_user($user->id, $course->id, $roleid);
-
 
3117
 
-
 
3118
        // Assign user a new local role.
-
 
3119
        $newroleid = $DB->get_field('role', 'id', ['shortname' => 'editingteacher'], MUST_EXIST);
-
 
3120
        role_assign($newroleid, $user->id, $cmcontext->id);
-
 
3121
 
-
 
3122
        // Duplicate module.
-
 
3123
        $newcm = duplicate_module($course, $cm);
-
 
3124
        $newcmcontext = \context_module::instance($newcm->id);
-
 
3125
 
-
 
3126
        // Assert that user still has role assigned.
-
 
3127
        $this->assertTrue(user_has_role_assignment($user->id, $newroleid, $newcmcontext->id));
-
 
3128
 
-
 
3129
        // Assert that both modules contain the same count of overrides.
-
 
3130
        $overrides = $DB->get_records('role_assignments', ['contextid' => $cmcontext->id]);
-
 
3131
        $newoverrides = $DB->get_records('role_assignments', ['contextid' => $newcmcontext->id]);
-
 
3132
        $this->assertEquals(count($overrides), count($newoverrides));
-
 
3133
    }
-
 
3134
 
3060
    /**
3135
    /**
3061
     * Tests that when creating or updating a module, if the availability settings
3136
     * Tests that when creating or updating a module, if the availability settings
3062
     * are present but set to an empty tree, availability is set to null in
3137
     * are present but set to an empty tree, availability is set to null in
3063
     * database.
3138
     * database.
3064
     */
3139
     */
3065
    public function test_empty_availability_settings() {
3140
    public function test_empty_availability_settings(): void {
3066
        global $DB;
3141
        global $DB;
3067
        $this->setAdminUser();
3142
        $this->setAdminUser();
Línea 3068... Línea 3143...
3068
        $this->resetAfterTest();
3143
        $this->resetAfterTest();
Línea 3097... Línea 3172...
3097
    }
3172
    }
Línea 3098... Línea 3173...
3098
 
3173
 
3099
    /**
3174
    /**
3100
     * Test update_inplace_editable()
3175
     * Test update_inplace_editable()
3101
     */
3176
     */
3102
    public function test_update_module_name_inplace() {
3177
    public function test_update_module_name_inplace(): void {
3103
        global $CFG, $DB, $PAGE;
3178
        global $CFG, $DB, $PAGE;
Línea 3104... Línea 3179...
3104
        require_once($CFG->dirroot . '/lib/external/externallib.php');
3179
        require_once($CFG->dirroot . '/lib/external/externallib.php');
Línea 3127... Línea 3202...
3127
    }
3202
    }
Línea 3128... Línea 3203...
3128
 
3203
 
3129
    /**
3204
    /**
3130
     * Testing function course_get_tagged_course_modules - search tagged course modules
3205
     * Testing function course_get_tagged_course_modules - search tagged course modules
3131
     */
3206
     */
3132
    public function test_course_get_tagged_course_modules() {
3207
    public function test_course_get_tagged_course_modules(): void {
3133
        global $DB;
3208
        global $DB;
3134
        $this->resetAfterTest();
3209
        $this->resetAfterTest();
3135
        $course3 = $this->getDataGenerator()->create_course();
3210
        $course3 = $this->getDataGenerator()->create_course();
3136
        $course2 = $this->getDataGenerator()->create_course();
3211
        $course2 = $this->getDataGenerator()->create_course();
Línea 3240... Línea 3315...
3240
    }
3315
    }
Línea 3241... Línea 3316...
3241
 
3316
 
3242
    /**
3317
    /**
3243
     * Test course_get_user_navigation_options for frontpage.
3318
     * Test course_get_user_navigation_options for frontpage.
3244
     */
3319
     */
3245
    public function test_course_get_user_navigation_options_for_frontpage() {
3320
    public function test_course_get_user_navigation_options_for_frontpage(): void {
3246
        global $CFG, $SITE, $DB;
3321
        global $CFG, $SITE, $DB;
3247
        $this->resetAfterTest();
3322
        $this->resetAfterTest();
3248
        $context = context_system::instance();
3323
        $context = context_system::instance();
3249
        $course = clone $SITE;
3324
        $course = clone $SITE;
Línea 3283... Línea 3358...
3283
    }
3358
    }
Línea 3284... Línea 3359...
3284
 
3359
 
3285
    /**
3360
    /**
3286
     * Test course_get_user_navigation_options for managers in a normal course.
3361
     * Test course_get_user_navigation_options for managers in a normal course.
3287
     */
3362
     */
3288
    public function test_course_get_user_navigation_options_for_managers() {
3363
    public function test_course_get_user_navigation_options_for_managers(): void {
3289
        global $CFG;
3364
        global $CFG;
3290
        $this->resetAfterTest();
3365
        $this->resetAfterTest();
3291
        $course = $this->getDataGenerator()->create_course();
3366
        $course = $this->getDataGenerator()->create_course();
3292
        $context = context_course::instance($course->id);
3367
        $context = context_course::instance($course->id);
Línea 3300... Línea 3375...
3300
    }
3375
    }
Línea 3301... Línea 3376...
3301
 
3376
 
3302
    /**
3377
    /**
3303
     * Test course_get_user_navigation_options for students in a normal course.
3378
     * Test course_get_user_navigation_options for students in a normal course.
3304
     */
3379
     */
3305
    public function test_course_get_user_navigation_options_for_students() {
3380
    public function test_course_get_user_navigation_options_for_students(): void {
3306
        global $DB, $CFG;
3381
        global $DB, $CFG;
3307
        $this->resetAfterTest();
3382
        $this->resetAfterTest();
3308
        $course = $this->getDataGenerator()->create_course();
3383
        $course = $this->getDataGenerator()->create_course();
Línea 3341... Línea 3416...
3341
    }
3416
    }
Línea 3342... Línea 3417...
3342
 
3417
 
3343
    /**
3418
    /**
3344
     * Test course_get_user_administration_options for frontpage.
3419
     * Test course_get_user_administration_options for frontpage.
3345
     */
3420
     */
3346
    public function test_course_get_user_administration_options_for_frontpage() {
3421
    public function test_course_get_user_administration_options_for_frontpage(): void {
3347
        global $CFG, $SITE;
3422
        global $CFG, $SITE;
3348
        $this->resetAfterTest();
3423
        $this->resetAfterTest();
3349
        $course = clone $SITE;
3424
        $course = clone $SITE;
3350
        $context = context_course::instance($course->id);
3425
        $context = context_course::instance($course->id);
Línea 3374... Línea 3449...
3374
    }
3449
    }
Línea 3375... Línea 3450...
3375
 
3450
 
3376
    /**
3451
    /**
3377
     * Test course_get_user_administration_options for managers in a normal course.
3452
     * Test course_get_user_administration_options for managers in a normal course.
3378
     */
3453
     */
3379
    public function test_course_get_user_administration_options_for_managers() {
3454
    public function test_course_get_user_administration_options_for_managers(): void {
3380
        global $CFG;
3455
        global $CFG;
3381
        $this->resetAfterTest();
3456
        $this->resetAfterTest();
3382
        $course = $this->getDataGenerator()->create_course();
3457
        $course = $this->getDataGenerator()->create_course();
3383
        $context = context_course::instance($course->id);
3458
        $context = context_course::instance($course->id);
Línea 3400... Línea 3475...
3400
    }
3475
    }
Línea 3401... Línea 3476...
3401
 
3476
 
3402
    /**
3477
    /**
3403
     * Test course_get_user_administration_options for students in a normal course.
3478
     * Test course_get_user_administration_options for students in a normal course.
3404
     */
3479
     */
3405
    public function test_course_get_user_administration_options_for_students() {
3480
    public function test_course_get_user_administration_options_for_students(): void {
3406
        global $DB, $CFG;
3481
        global $DB, $CFG;
3407
        $this->resetAfterTest();
3482
        $this->resetAfterTest();
3408
        $course = $this->getDataGenerator()->create_course();
3483
        $course = $this->getDataGenerator()->create_course();
Línea 3435... Línea 3510...
3435
    }
3510
    }
Línea 3436... Línea 3511...
3436
 
3511
 
3437
    /**
3512
    /**
3438
     * Test test_update_course_frontpage_category.
3513
     * Test test_update_course_frontpage_category.
3439
     */
3514
     */
3440
    public function test_update_course_frontpage_category() {
3515
    public function test_update_course_frontpage_category(): void {
3441
        // Fetch front page course.
3516
        // Fetch front page course.
3442
        $course = get_course(SITEID);
3517
        $course = get_course(SITEID);
3443
        // Test update information on front page course.
3518
        // Test update information on front page course.
3444
        $course->category = 99;
3519
        $course->category = 99;
Línea 3453... Línea 3528...
3453
     * @dataProvider course_enddate_provider
3528
     * @dataProvider course_enddate_provider
3454
     * @param int $startdate
3529
     * @param int $startdate
3455
     * @param int $enddate
3530
     * @param int $enddate
3456
     * @param string $errorcode
3531
     * @param string $errorcode
3457
     */
3532
     */
3458
    public function test_course_enddate($startdate, $enddate, $errorcode) {
3533
    public function test_course_enddate($startdate, $enddate, $errorcode): void {
Línea 3459... Línea 3534...
3459
 
3534
 
Línea 3460... Línea 3535...
3460
        $this->resetAfterTest(true);
3535
        $this->resetAfterTest(true);
3461
 
3536
 
Línea 3517... Línea 3592...
3517
     * @param int $resetstartdate
3592
     * @param int $resetstartdate
3518
     * @param int $resetenddate
3593
     * @param int $resetenddate
3519
     * @param int $resultingstartdate
3594
     * @param int $resultingstartdate
3520
     * @param int $resultingenddate
3595
     * @param int $resultingenddate
3521
     */
3596
     */
3522
    public function test_course_dates_reset($startdate, $enddate, $resetstartdate, $resetenddate, $resultingstartdate, $resultingenddate) {
3597
    public function test_course_dates_reset($startdate, $enddate, $resetstartdate, $resetenddate, $resultingstartdate, $resultingenddate): void {
3523
        global $CFG, $DB;
3598
        global $CFG, $DB;
Línea 3524... Línea 3599...
3524
 
3599
 
Línea 3525... Línea 3600...
3525
        require_once($CFG->dirroot.'/completion/criteria/completion_criteria_date.php');
3600
        require_once($CFG->dirroot.'/completion/criteria/completion_criteria_date.php');
Línea 3628... Línea 3703...
3628
    /**
3703
    /**
3629
     * Test reset_course_userdata()
3704
     * Test reset_course_userdata()
3630
     *    - with reset_roles_overrides enabled
3705
     *    - with reset_roles_overrides enabled
3631
     *    - with selective role unenrolments
3706
     *    - with selective role unenrolments
3632
     */
3707
     */
3633
    public function test_course_roles_reset() {
3708
    public function test_course_roles_reset(): void {
3634
        global $DB;
3709
        global $DB;
Línea 3635... Línea 3710...
3635
 
3710
 
Línea 3636... Línea 3711...
3636
        $this->resetAfterTest(true);
3711
        $this->resetAfterTest(true);
Línea 3692... Línea 3767...
3692
 
3767
 
3693
        $usersroles = enrol_get_course_users_roles($course->id);
3768
        $usersroles = enrol_get_course_users_roles($course->id);
3694
        $this->assertEmpty($usersroles);
3769
        $this->assertEmpty($usersroles);
Línea 3695... Línea 3770...
3695
    }
3770
    }
3696
 
3771
 
3697
    public function test_course_check_module_updates_since() {
3772
    public function test_course_check_module_updates_since(): void {
3698
        global $CFG, $DB, $USER;
3773
        global $CFG, $DB, $USER;
3699
        require_once($CFG->dirroot . '/mod/glossary/lib.php');
3774
        require_once($CFG->dirroot . '/mod/glossary/lib.php');
Línea 3780... Línea 3855...
3780
        $this->assertTrue($updates->ratings->updated);
3855
        $this->assertTrue($updates->ratings->updated);
3781
        $this->assertFalse($updates->introfiles->updated);
3856
        $this->assertFalse($updates->introfiles->updated);
3782
        $this->assertFalse($updates->outcomes->updated);
3857
        $this->assertFalse($updates->outcomes->updated);
3783
    }
3858
    }
Línea 3784... Línea 3859...
3784
 
3859
 
3785
    public function test_async_module_deletion_hook_implemented() {
3860
    public function test_async_module_deletion_hook_implemented(): void {
3786
        // Async module deletion depends on the 'true' being returned by at least one plugin implementing the hook,
3861
        // Async module deletion depends on the 'true' being returned by at least one plugin implementing the hook,
3787
        // 'course_module_adhoc_deletion_recommended'. In core, is implemented by the course recyclebin, which will only return
3862
        // 'course_module_adhoc_deletion_recommended'. In core, is implemented by the course recyclebin, which will only return
3788
        // true if the recyclebin plugin is enabled. To make sure async deletion occurs, this test force-enables the recyclebin.
3863
        // true if the recyclebin plugin is enabled. To make sure async deletion occurs, this test force-enables the recyclebin.
3789
        global $DB, $USER;
3864
        global $DB, $USER;
Línea 3847... Línea 3922...
3847
        // Verify the course_module record has been deleted.
3922
        // Verify the course_module record has been deleted.
3848
        $cmcount = $DB->count_records('course_modules', ['id' => $module->cmid]);
3923
        $cmcount = $DB->count_records('course_modules', ['id' => $module->cmid]);
3849
        $this->assertEmpty($cmcount);
3924
        $this->assertEmpty($cmcount);
3850
    }
3925
    }
Línea 3851... Línea 3926...
3851
 
3926
 
3852
    public function test_async_module_deletion_hook_not_implemented() {
3927
    public function test_async_module_deletion_hook_not_implemented(): void {
3853
        // Only proceed if we are sure that no plugin is going to advocate async removal of a module. I.e. no plugin returns
3928
        // Only proceed if we are sure that no plugin is going to advocate async removal of a module. I.e. no plugin returns
3854
        // 'true' from the 'course_module_adhoc_deletion_recommended' hook.
3929
        // 'true' from the 'course_module_adhoc_deletion_recommended' hook.
3855
        // In the case of core, only recyclebin implements this hook, and it will only return true if enabled, so disable it.
3930
        // In the case of core, only recyclebin implements this hook, and it will only return true if enabled, so disable it.
3856
        global $DB, $USER;
3931
        global $DB, $USER;
Línea 3902... Línea 3977...
3902
        // Verify the course_module record has been deleted.
3977
        // Verify the course_module record has been deleted.
3903
        $cmcount = $DB->count_records('course_modules', ['id' => $module->cmid]);
3978
        $cmcount = $DB->count_records('course_modules', ['id' => $module->cmid]);
3904
        $this->assertEmpty($cmcount);
3979
        $this->assertEmpty($cmcount);
3905
    }
3980
    }
Línea 3906... Línea 3981...
3906
 
3981
 
3907
    public function test_async_section_deletion_hook_implemented() {
3982
    public function test_async_section_deletion_hook_implemented(): void {
3908
        // Async section deletion (provided section contains modules), depends on the 'true' being returned by at least one plugin
3983
        // Async section deletion (provided section contains modules), depends on the 'true' being returned by at least one plugin
3909
        // implementing the 'course_module_adhoc_deletion_recommended' hook. In core, is implemented by the course recyclebin,
3984
        // implementing the 'course_module_adhoc_deletion_recommended' hook. In core, is implemented by the course recyclebin,
3910
        // which will only return true if the plugin is enabled. To make sure async deletion occurs, this test enables recyclebin.
3985
        // which will only return true if the plugin is enabled. To make sure async deletion occurs, this test enables recyclebin.
3911
        global $DB, $USER;
3986
        global $DB, $USER;
Línea 3990... Línea 4065...
3990
            }
4065
            }
3991
        }
4066
        }
3992
        $this->assertEquals(3, $count);
4067
        $this->assertEquals(3, $count);
3993
    }
4068
    }
Línea 3994... Línea 4069...
3994
 
4069
 
3995
    public function test_async_section_deletion_hook_not_implemented() {
4070
    public function test_async_section_deletion_hook_not_implemented(): void {
3996
        // If no plugins advocate async removal, then normal synchronous removal will take place.
4071
        // If no plugins advocate async removal, then normal synchronous removal will take place.
3997
        // Only proceed if we are sure that no plugin is going to advocate async removal of a module. I.e. no plugin returns
4072
        // Only proceed if we are sure that no plugin is going to advocate async removal of a module. I.e. no plugin returns
3998
        // 'true' from the 'course_module_adhoc_deletion_recommended' hook.
4073
        // 'true' from the 'course_module_adhoc_deletion_recommended' hook.
3999
        // In the case of core, only recyclebin implements this hook, and it will only return true if enabled, so disable it.
4074
        // In the case of core, only recyclebin implements this hook, and it will only return true if enabled, so disable it.
Línea 4066... Línea 4141...
4066
            }
4141
            }
4067
        }
4142
        }
4068
        $this->assertEquals(2, $count);
4143
        $this->assertEquals(2, $count);
4069
    }
4144
    }
Línea 4070... Línea 4145...
4070
 
4145
 
4071
    public function test_classify_course_for_timeline() {
4146
    public function test_classify_course_for_timeline(): void {
Línea 4072... Línea 4147...
4072
        global $DB, $CFG;
4147
        global $DB, $CFG;
Línea 4073... Línea 4148...
4073
 
4148
 
Línea 4127... Línea 4202...
4127
    }
4202
    }
Línea 4128... Línea 4203...
4128
 
4203
 
4129
    /**
4204
    /**
4130
     * Test the main function for updating all calendar events for a module.
4205
     * Test the main function for updating all calendar events for a module.
4131
     */
4206
     */
4132
    public function test_course_module_calendar_event_update_process() {
4207
    public function test_course_module_calendar_event_update_process(): void {
Línea 4133... Línea 4208...
4133
        global $DB;
4208
        global $DB;
4134
 
4209
 
Línea 4188... Línea 4263...
4188
    }
4263
    }
Línea 4189... Línea 4264...
4189
 
4264
 
4190
    /**
4265
    /**
4191
     * Test the higher level checks for updating calendar events for an instance.
4266
     * Test the higher level checks for updating calendar events for an instance.
4192
     */
4267
     */
4193
    public function test_course_module_update_calendar_events() {
4268
    public function test_course_module_update_calendar_events(): void {
4194
        $this->resetAfterTest();
4269
        $this->resetAfterTest();
Línea 4195... Línea 4270...
4195
        $this->setAdminUser();
4270
        $this->setAdminUser();
4196
 
4271
 
Línea 4217... Línea 4292...
4217
    }
4292
    }
Línea 4218... Línea 4293...
4218
 
4293
 
4219
    /**
4294
    /**
4220
     * Test the higher level checks for updating calendar events for a module.
4295
     * Test the higher level checks for updating calendar events for a module.
4221
     */
4296
     */
4222
    public function test_course_module_bulk_update_calendar_events() {
4297
    public function test_course_module_bulk_update_calendar_events(): void {
4223
        $this->resetAfterTest();
4298
        $this->resetAfterTest();
Línea 4224... Línea 4299...
4224
        $this->setAdminUser();
4299
        $this->setAdminUser();
4225
 
4300
 
Línea 4245... Línea 4320...
4245
    }
4320
    }
Línea 4246... Línea 4321...
4246
 
4321
 
4247
    /**
4322
    /**
4248
     * Test that a student can view participants in a course they are enrolled in.
4323
     * Test that a student can view participants in a course they are enrolled in.
4249
     */
4324
     */
4250
    public function test_course_can_view_participants_as_student() {
4325
    public function test_course_can_view_participants_as_student(): void {
Línea 4251... Línea 4326...
4251
        $this->resetAfterTest();
4326
        $this->resetAfterTest();
4252
 
4327
 
Línea 4262... Línea 4337...
4262
    }
4337
    }
Línea 4263... Línea 4338...
4263
 
4338
 
4264
    /**
4339
    /**
4265
     * Test that a student in a course can not view participants on the site.
4340
     * Test that a student in a course can not view participants on the site.
4266
     */
4341
     */
4267
    public function test_course_can_view_participants_as_student_on_site() {
4342
    public function test_course_can_view_participants_as_student_on_site(): void {
Línea 4268... Línea 4343...
4268
        $this->resetAfterTest();
4343
        $this->resetAfterTest();
Línea 4269... Línea 4344...
4269
 
4344
 
Línea 4278... Línea 4353...
4278
    }
4353
    }
Línea 4279... Línea 4354...
4279
 
4354
 
4280
    /**
4355
    /**
4281
     * Test that an admin can view participants on the site.
4356
     * Test that an admin can view participants on the site.
4282
     */
4357
     */
4283
    public function test_course_can_view_participants_as_admin_on_site() {
4358
    public function test_course_can_view_participants_as_admin_on_site(): void {
Línea 4284... Línea 4359...
4284
        $this->resetAfterTest();
4359
        $this->resetAfterTest();
Línea 4285... Línea 4360...
4285
 
4360
 
4286
        $this->setAdminUser();
4361
        $this->setAdminUser();
Línea 4287... Línea 4362...
4287
 
4362
 
4288
        $this->assertTrue(course_can_view_participants(context_system::instance()));
4363
        $this->assertTrue(course_can_view_participants(context_system::instance()));
4289
    }
4364
    }
4290
 
4365
 
4291
    /**
4366
    /**
Línea 4292... Línea 4367...
4292
     * Test teachers can view participants in a course they are enrolled in.
4367
     * Test teachers can view participants in a course they are enrolled in.
Línea 4293... Línea 4368...
4293
     */
4368
     */
Línea 4309... Línea 4384...
4309
    }
4384
    }
Línea 4310... Línea 4385...
4310
 
4385
 
4311
    /**
4386
    /**
4312
     * Check the teacher can still view the participants page without the 'viewparticipants' cap.
4387
     * Check the teacher can still view the participants page without the 'viewparticipants' cap.
4313
     */
4388
     */
4314
    public function test_course_can_view_participants_as_teacher_without_view_participants_cap() {
4389
    public function test_course_can_view_participants_as_teacher_without_view_participants_cap(): void {
Línea 4315... Línea 4390...
4315
        global $DB;
4390
        global $DB;
Línea 4316... Línea 4391...
4316
 
4391
 
Línea 4333... Línea 4408...
4333
    }
4408
    }
Línea 4334... Línea 4409...
4334
 
4409
 
4335
    /**
4410
    /**
4336
     * Check the teacher can still view the participants page without the 'moodle/course:enrolreview' cap.
4411
     * Check the teacher can still view the participants page without the 'moodle/course:enrolreview' cap.
4337
     */
4412
     */
4338
    public function test_course_can_view_participants_as_teacher_without_enrol_review_cap() {
4413
    public function test_course_can_view_participants_as_teacher_without_enrol_review_cap(): void {
Línea 4339... Línea 4414...
4339
        global $DB;
4414
        global $DB;
Línea 4340... Línea 4415...
4340
 
4415
 
Línea 4357... Línea 4432...
4357
    }
4432
    }
Línea 4358... Línea 4433...
4358
 
4433
 
4359
    /**
4434
    /**
4360
     * Check the teacher can not view the participants page without the required caps.
4435
     * Check the teacher can not view the participants page without the required caps.
4361
     */
4436
     */
4362
    public function test_course_can_view_participants_as_teacher_without_required_caps() {
4437
    public function test_course_can_view_participants_as_teacher_without_required_caps(): void {
Línea 4363... Línea 4438...
4363
        global $DB;
4438
        global $DB;
Línea 4364... Línea 4439...
4364
 
4439
 
Línea 4381... Línea 4456...
4381
    }
4456
    }
Línea 4382... Línea 4457...
4382
 
4457
 
4383
    /**
4458
    /**
4384
     * Check that an exception is not thrown if we can view the participants page.
4459
     * Check that an exception is not thrown if we can view the participants page.
4385
     */
4460
     */
4386
    public function test_course_require_view_participants() {
4461
    public function test_course_require_view_participants(): void {
Línea 4387... Línea 4462...
4387
        $this->resetAfterTest();
4462
        $this->resetAfterTest();
4388
 
4463
 
Línea 4398... Línea 4473...
4398
    }
4473
    }
Línea 4399... Línea 4474...
4399
 
4474
 
4400
    /**
4475
    /**
4401
     * Check that an exception is thrown if we can't view the participants page.
4476
     * Check that an exception is thrown if we can't view the participants page.
4402
     */
4477
     */
4403
    public function test_course_require_view_participants_as_student_on_site() {
4478
    public function test_course_require_view_participants_as_student_on_site(): void {
Línea 4404... Línea 4479...
4404
        $this->resetAfterTest();
4479
        $this->resetAfterTest();
Línea 4405... Línea 4480...
4405
 
4480
 
Línea 4415... Línea 4490...
4415
    }
4490
    }
Línea 4416... Línea 4491...
4416
 
4491
 
4417
    /**
4492
    /**
4418
     *  Testing the can_download_from_backup_filearea fn.
4493
     *  Testing the can_download_from_backup_filearea fn.
4419
     */
4494
     */
4420
    public function test_can_download_from_backup_filearea() {
4495
    public function test_can_download_from_backup_filearea(): void {
4421
        global $DB;
4496
        global $DB;
4422
        $this->resetAfterTest();
4497
        $this->resetAfterTest();
4423
        $course = $this->getDataGenerator()->create_course();
4498
        $course = $this->getDataGenerator()->create_course();
4424
        $context = context_course::instance($course->id);
4499
        $context = context_course::instance($course->id);
Línea 4580... Línea 4655...
4580
     *
4655
     *
4581
     * @dataProvider get_course_classify_courses_for_timeline_test_cases()
4656
     * @dataProvider get_course_classify_courses_for_timeline_test_cases()
4582
     * @param array $coursesdata Courses to create
4657
     * @param array $coursesdata Courses to create
4583
     * @param array $expected Expected test results.
4658
     * @param array $expected Expected test results.
4584
     */
4659
     */
4585
    public function test_course_classify_courses_for_timeline($coursesdata, $expected) {
4660
    public function test_course_classify_courses_for_timeline($coursesdata, $expected): void {
4586
        $this->resetAfterTest();
4661
        $this->resetAfterTest();
4587
        $generator = $this->getDataGenerator();
4662
        $generator = $this->getDataGenerator();
Línea 4588... Línea 4663...
4588
 
4663
 
4589
        $courses = array_map(function($coursedata) use ($generator) {
4664
        $courses = array_map(function($coursedata) use ($generator) {
Línea 4721... Línea 4796...
4721
        $totalcourses,
4796
        $totalcourses,
4722
        $limit,
4797
        $limit,
4723
        $offset,
4798
        $offset,
4724
        $expecteddbqueries,
4799
        $expecteddbqueries,
4725
        $expectedresult
4800
        $expectedresult
4726
    ) {
4801
    ): void {
4727
        global $DB;
4802
        global $DB;
Línea 4728... Línea 4803...
4728
 
4803
 
4729
        $this->resetAfterTest();
4804
        $this->resetAfterTest();
4730
        $generator = $this->getDataGenerator();
4805
        $generator = $this->getDataGenerator();
Línea 4906... Línea 4981...
4906
    }
4981
    }
Línea 4907... Línea 4982...
4907
 
4982
 
4908
    /**
4983
    /**
4909
     * Test the course_get_enrolled_courses_for_logged_in_user_from_search function.
4984
     * Test the course_get_enrolled_courses_for_logged_in_user_from_search function.
4910
     */
4985
     */
4911
    public function test_course_get_enrolled_courses_for_logged_in_user_from_search() {
4986
    public function test_course_get_enrolled_courses_for_logged_in_user_from_search(): void {
Línea 4912... Línea 4987...
4912
        global $DB;
4987
        global $DB;
Línea 4913... Línea 4988...
4913
 
4988
 
Línea 5019... Línea 5094...
5019
        $classification,
5094
        $classification,
5020
        $limit,
5095
        $limit,
5021
        $offset,
5096
        $offset,
5022
        $expectedcourses,
5097
        $expectedcourses,
5023
        $expectedprocessedcount
5098
        $expectedprocessedcount
5024
    ) {
5099
    ): void {
5025
        $this->resetAfterTest();
5100
        $this->resetAfterTest();
5026
        $generator = $this->getDataGenerator();
5101
        $generator = $this->getDataGenerator();
Línea 5027... Línea 5102...
5027
 
5102
 
5028
        $courses = array_map(function($coursedata) use ($generator) {
5103
        $courses = array_map(function($coursedata) use ($generator) {
Línea 5240... Línea 5315...
5240
        $customfieldvalue,
5315
        $customfieldvalue,
5241
        $limit,
5316
        $limit,
5242
        $offset,
5317
        $offset,
5243
        $expectedcourses,
5318
        $expectedcourses,
5244
        $expectedprocessedcount
5319
        $expectedprocessedcount
5245
    ) {
5320
    ): void {
5246
        $this->resetAfterTest();
5321
        $this->resetAfterTest();
5247
        $generator = $this->getDataGenerator();
5322
        $generator = $this->getDataGenerator();
Línea 5248... Línea 5323...
5248
 
5323
 
5249
        // Create the custom fields.
5324
        // Create the custom fields.
Línea 5485... Línea 5560...
5485
        $limit,
5560
        $limit,
5486
        $offset,
5561
        $offset,
5487
        $expectedcourses,
5562
        $expectedcourses,
5488
        $expectedprocessedcount,
5563
        $expectedprocessedcount,
5489
        $hiddencourse
5564
        $hiddencourse
5490
    ) {
5565
    ): void {
5491
        $this->resetAfterTest();
5566
        $this->resetAfterTest();
5492
        $generator = $this->getDataGenerator();
5567
        $generator = $this->getDataGenerator();
5493
        $student = $generator->create_user();
5568
        $student = $generator->create_user();
5494
        $this->setUser($student);
5569
        $this->setUser($student);
Línea 5522... Línea 5597...
5522
 
5597
 
5523
 
5598
 
5524
    /**
5599
    /**
5525
     * Testing core_course_core_calendar_get_valid_event_timestart_range when the course has no end date.
5600
     * Testing core_course_core_calendar_get_valid_event_timestart_range when the course has no end date.
5526
     */
5601
     */
5527
    public function test_core_course_core_calendar_get_valid_event_timestart_range_no_enddate() {
5602
    public function test_core_course_core_calendar_get_valid_event_timestart_range_no_enddate(): void {
Línea 5528... Línea 5603...
5528
        global $CFG;
5603
        global $CFG;
5529
        require_once($CFG->dirroot . "/calendar/lib.php");
5604
        require_once($CFG->dirroot . "/calendar/lib.php");
Línea 5547... Línea 5622...
5547
    }
5622
    }
Línea 5548... Línea 5623...
5548
 
5623
 
5549
    /**
5624
    /**
5550
     * Testing core_course_core_calendar_get_valid_event_timestart_range when the course has end date.
5625
     * Testing core_course_core_calendar_get_valid_event_timestart_range when the course has end date.
5551
     */
5626
     */
5552
    public function test_core_course_core_calendar_get_valid_event_timestart_range_with_enddate() {
5627
    public function test_core_course_core_calendar_get_valid_event_timestart_range_with_enddate(): void {
5553
        global $CFG;
5628
        global $CFG;
Línea 5554... Línea 5629...
5554
        require_once($CFG->dirroot . "/calendar/lib.php");
5629
        require_once($CFG->dirroot . "/calendar/lib.php");
5555
 
5630
 
Línea 5572... Línea 5647...
5572
    }
5647
    }
Línea 5573... Línea 5648...
5573
 
5648
 
5574
    /**
5649
    /**
5575
     * Test the course_get_recent_courses function.
5650
     * Test the course_get_recent_courses function.
5576
     */
5651
     */
5577
    public function test_course_get_recent_courses() {
5652
    public function test_course_get_recent_courses(): void {
Línea 5578... Línea 5653...
5578
        global $DB;
5653
        global $DB;
5579
 
5654
 
Línea 5661... Línea 5736...
5661
     *
5736
     *
5662
     * @dataProvider course_get_recent_courses_sort_validation_provider
5737
     * @dataProvider course_get_recent_courses_sort_validation_provider
5663
     * @param string $sort The sort value
5738
     * @param string $sort The sort value
5664
     * @param string $expectedexceptionmsg The expected exception message
5739
     * @param string $expectedexceptionmsg The expected exception message
5665
     */
5740
     */
5666
    public function test_course_get_recent_courses_sort_validation(string $sort, string $expectedexceptionmsg) {
5741
    public function test_course_get_recent_courses_sort_validation(string $sort, string $expectedexceptionmsg): void {
5667
        $this->resetAfterTest();
5742
        $this->resetAfterTest();
Línea 5668... Línea 5743...
5668
 
5743
 
Línea 5669... Línea 5744...
5669
        $user = $this->getDataGenerator()->create_user();
5744
        $user = $this->getDataGenerator()->create_user();
Línea 5708... Línea 5783...
5708
    }
5783
    }
Línea 5709... Línea 5784...
5709
 
5784
 
5710
    /**
5785
    /**
5711
     * Test the course_get_recent_courses function.
5786
     * Test the course_get_recent_courses function.
5712
     */
5787
     */
5713
    public function test_course_get_recent_courses_with_guest() {
5788
    public function test_course_get_recent_courses_with_guest(): void {
5714
        global $DB;
5789
        global $DB;
Línea 5715... Línea 5790...
5715
        $this->resetAfterTest(true);
5790
        $this->resetAfterTest(true);
Línea 6981... Línea 7056...
6981
        $coursestart,
7056
        $coursestart,
6982
        $usercount,
7057
        $usercount,
6983
        $enrolmentmethods,
7058
        $enrolmentmethods,
6984
        $enrolled,
7059
        $enrolled,
6985
        $expected
7060
        $expected
6986
    ) {
7061
    ): void {
6987
        global $DB;
7062
        global $DB;
6988
        $this->resetAfterTest();
7063
        $this->resetAfterTest();
Línea 6989... Línea 7064...
6989
 
7064
 
6990
        $generator = $this->getDataGenerator();
7065
        $generator = $this->getDataGenerator();
Línea 7027... Línea 7102...
7027
 
7102
 
7028
    /**
7103
    /**
7029
     * Test that calling course_get_course_dates_for_user_ids multiple times in the
7104
     * Test that calling course_get_course_dates_for_user_ids multiple times in the
7030
     * same request fill fetch the correct data for the user.
7105
     * same request fill fetch the correct data for the user.
7031
     */
7106
     */
7032
    public function test_course_get_course_dates_for_user_ids_multiple_calls() {
7107
    public function test_course_get_course_dates_for_user_ids_multiple_calls(): void {
Línea 7033... Línea 7108...
7033
        $this->resetAfterTest();
7108
        $this->resetAfterTest();
7034
 
7109
 
7035
        $generator = $this->getDataGenerator();
7110
        $generator = $this->getDataGenerator();
Línea 7081... Línea 7156...
7081
     * @param int $indextodelete The index of the module in the $modules array that we want to test with
7156
     * @param int $indextodelete The index of the module in the $modules array that we want to test with
7082
     * @param bool $gradable The value to pass to the gradable argument of the course_modules_pending_deletion function
7157
     * @param bool $gradable The value to pass to the gradable argument of the course_modules_pending_deletion function
7083
     * @param bool $expected The expected result
7158
     * @param bool $expected The expected result
7084
     * @dataProvider provider_course_modules_pending_deletion
7159
     * @dataProvider provider_course_modules_pending_deletion
7085
     */
7160
     */
7086
    public function test_course_modules_pending_deletion(array $modules, int $indextodelete, bool $gradable, bool $expected) {
7161
    public function test_course_modules_pending_deletion(array $modules, int $indextodelete, bool $gradable, bool $expected): void {
7087
        $this->resetAfterTest();
7162
        $this->resetAfterTest();
Línea 7088... Línea 7163...
7088
 
7163
 
7089
        // Ensure recyclebin is enabled.
7164
        // Ensure recyclebin is enabled.
Línea 7103... Línea 7178...
7103
    }
7178
    }
Línea 7104... Línea 7179...
7104
 
7179
 
7105
    /**
7180
    /**
7106
     * Tests for the course_request::can_request
7181
     * Tests for the course_request::can_request
7107
     */
7182
     */
7108
    public function test_can_request_course() {
7183
    public function test_can_request_course(): void {
7109
        global $CFG, $DB;
7184
        global $CFG, $DB;
Línea 7110... Línea 7185...
7110
        $this->resetAfterTest();
7185
        $this->resetAfterTest();
7111
 
7186
 
Línea 7167... Línea 7242...
7167
    }
7242
    }
Línea 7168... Línea 7243...
7168
 
7243
 
7169
    /**
7244
    /**
7170
     * Tests for the course_request::can_approve
7245
     * Tests for the course_request::can_approve
7171
     */
7246
     */
7172
    public function test_can_approve_course_request() {
7247
    public function test_can_approve_course_request(): void {
7173
        global $CFG;
7248
        global $CFG;
Línea 7174... Línea 7249...
7174
        $this->resetAfterTest();
7249
        $this->resetAfterTest();
7175
 
7250
 
Línea 7209... Línea 7284...
7209
    }
7284
    }
Línea 7210... Línea 7285...
7210
 
7285
 
7211
    /**
7286
    /**
7212
     * Test the course allowed module method.
7287
     * Test the course allowed module method.
7213
     */
7288
     */
7214
    public function test_course_allowed_module() {
7289
    public function test_course_allowed_module(): void {
7215
        $this->resetAfterTest();
7290
        $this->resetAfterTest();
Línea 7216... Línea 7291...
7216
        global $DB;
7291
        global $DB;
7217
 
7292
 
Línea 7231... Línea 7306...
7231
    }
7306
    }
Línea 7232... Línea 7307...
7232
 
7307
 
7233
    /**
7308
    /**
7234
     * Test the {@link average_number_of_participants()} function.
7309
     * Test the {@link average_number_of_participants()} function.
7235
     */
7310
     */
7236
    public function test_average_number_of_participants() {
7311
    public function test_average_number_of_participants(): void {
7237
        global $DB;
7312
        global $DB;
Línea 7238... Línea 7313...
7238
        $this->resetAfterTest(true);
7313
        $this->resetAfterTest(true);
7239
 
7314
 
Línea 7304... Línea 7379...
7304
    }
7379
    }
Línea 7305... Línea 7380...
7305
 
7380
 
7306
    /**
7381
    /**
7307
     * Test the set_downloadcontent() function.
7382
     * Test the set_downloadcontent() function.
7308
     */
7383
     */
7309
    public function test_set_downloadcontent() {
7384
    public function test_set_downloadcontent(): void {
Línea 7310... Línea 7385...
7310
        $this->resetAfterTest();
7385
        $this->resetAfterTest();
7311
 
7386
 
7312
        $generator = $this->getDataGenerator();
7387
        $generator = $this->getDataGenerator();