mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-81522 phpunit: Add missing void return type to all tests #2
This commit includes more changes, all them also adding the :void return type to unit tests missing them. The difference is that all these changes, while also detected perfectly by the moodle.PHPUnit.TestReturnType sniff, were not auto-fixed (like the previous commit ones), because all them do include some "return" statement and, for safety, we don't fix them. All the cases have been visually inspected and confirmed that the existing "return" statements always belong to anon functions within the test body and not the test own return statement.
This commit is contained in:
parent
01148a0816
commit
4f7631113c
@ -867,7 +867,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a module context previously flagged as approved is removed with appropriate unexpiredroles kept.
|
||||
*/
|
||||
public function test_process_course_context_with_override_unexpired_role() {
|
||||
public function test_process_course_context_with_override_unexpired_role(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@ -955,7 +955,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept.
|
||||
*/
|
||||
public function test_process_course_context_with_override_expired_role() {
|
||||
public function test_process_course_context_with_override_expired_role(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@ -1043,7 +1043,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept.
|
||||
*/
|
||||
public function test_process_course_context_with_user_in_both_lists() {
|
||||
public function test_process_course_context_with_user_in_both_lists(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@ -1132,7 +1132,7 @@ class expired_contexts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept.
|
||||
*/
|
||||
public function test_process_course_context_with_user_in_both_lists_expired() {
|
||||
public function test_process_course_context_with_user_in_both_lists_expired(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class manager_observer_test extends data_privacy_testcase {
|
||||
/**
|
||||
* Ensure that when users are configured as DPO, they are sent an message upon failure.
|
||||
*/
|
||||
public function test_handle_component_failure() {
|
||||
public function test_handle_component_failure(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create another user who is not a DPO.
|
||||
|
@ -30,7 +30,7 @@ class maketestcourse_test extends \advanced_testcase {
|
||||
/**
|
||||
* Creates a small test course and checks all the components have been put in place.
|
||||
*/
|
||||
public function test_make_xs_course() {
|
||||
public function test_make_xs_course(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
@ -193,7 +193,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test that list of policies can be filtered by audience
|
||||
*/
|
||||
public function test_list_policies_audience() {
|
||||
public function test_list_policies_audience(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
2
cache/tests/administration_helper_test.php
vendored
2
cache/tests/administration_helper_test.php
vendored
@ -60,7 +60,7 @@ class administration_helper_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the numerous summaries the helper can produce.
|
||||
*/
|
||||
public function test_get_summaries() {
|
||||
public function test_get_summaries(): void {
|
||||
// First the preparation.
|
||||
$config = cache_config_writer::instance();
|
||||
$this->assertTrue($config->add_store_instance('summariesstore', 'file'));
|
||||
|
@ -85,7 +85,7 @@ class event_factory_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test invalid callback exception.
|
||||
*/
|
||||
public function test_invalid_action_callback() {
|
||||
public function test_invalid_action_callback(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
$event = $this->create_event();
|
||||
@ -135,7 +135,7 @@ class event_factory_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test invalid callback exception.
|
||||
*/
|
||||
public function test_invalid_visibility_callback() {
|
||||
public function test_invalid_visibility_callback(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
$event = $this->create_event();
|
||||
@ -185,7 +185,7 @@ class event_factory_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test invalid callback exception.
|
||||
*/
|
||||
public function test_invalid_bail_callback() {
|
||||
public function test_invalid_bail_callback(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
$event = $this->create_event();
|
||||
@ -235,7 +235,7 @@ class event_factory_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the factory's course cache.
|
||||
*/
|
||||
public function test_course_cache() {
|
||||
public function test_course_cache(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
$course = self::getDataGenerator()->create_course();
|
||||
@ -288,7 +288,7 @@ class event_factory_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the factory's module cache.
|
||||
*/
|
||||
public function test_module_cache() {
|
||||
public function test_module_cache(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
$course = self::getDataGenerator()->create_course();
|
||||
|
@ -196,7 +196,7 @@ class event_vault_test extends \advanced_testcase {
|
||||
* provided timesort values and the last seen event can be provided to
|
||||
* get paginated results.
|
||||
*/
|
||||
public function test_get_action_events_by_timesort_between_time_skip_even_records() {
|
||||
public function test_get_action_events_by_timesort_between_time_skip_even_records(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminuser();
|
||||
|
||||
@ -247,7 +247,7 @@ class event_vault_test extends \advanced_testcase {
|
||||
* number of events requested has been satisfied. In this case the first
|
||||
* five events are rejected so it should require two database requests.
|
||||
*/
|
||||
public function test_get_action_events_by_timesort_between_time_skip_first_records() {
|
||||
public function test_get_action_events_by_timesort_between_time_skip_first_records(): void {
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminuser();
|
||||
|
||||
@ -423,7 +423,7 @@ class event_vault_test extends \advanced_testcase {
|
||||
* - A user in group B should see only the B override
|
||||
* - A user in both A and B should see both
|
||||
*/
|
||||
public function test_get_action_events_by_timesort_with_identical_group_override_priorities() {
|
||||
public function test_get_action_events_by_timesort_with_identical_group_override_priorities(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminuser();
|
||||
|
||||
@ -804,7 +804,7 @@ class event_vault_test extends \advanced_testcase {
|
||||
* provided timesort values and the last seen event can be provided to
|
||||
* get paginated results.
|
||||
*/
|
||||
public function test_get_action_events_by_course_between_time_skip_even_records() {
|
||||
public function test_get_action_events_by_course_between_time_skip_even_records(): void {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$course1 = $this->getDataGenerator()->create_course();
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
@ -870,7 +870,7 @@ class event_vault_test extends \advanced_testcase {
|
||||
* number of events requested has been satisfied. In this case the first
|
||||
* five events are rejected so it should require two database requests.
|
||||
*/
|
||||
public function test_get_action_events_by_course_between_time_skip_first_records() {
|
||||
public function test_get_action_events_by_course_between_time_skip_first_records(): void {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$course1 = $this->getDataGenerator()->create_course();
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
@ -1080,7 +1080,7 @@ class event_vault_test extends \advanced_testcase {
|
||||
* - A user in group B should see only the B override
|
||||
* - A user in both A and B should see both
|
||||
*/
|
||||
public function test_get_action_events_by_course_with_identical_group_override_priorities() {
|
||||
public function test_get_action_events_by_course_with_identical_group_override_priorities(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminuser();
|
||||
|
||||
|
@ -1425,7 +1425,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
* Test that get_action_events_by_courses will return a list of events for each
|
||||
* course you provided as long as the user is enrolled in the course.
|
||||
*/
|
||||
public function test_get_action_events_by_courses() {
|
||||
public function test_get_action_events_by_courses(): void {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$course1 = $this->getDataGenerator()->create_course();
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
@ -1558,7 +1558,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test get_action_events_by_courses with search feature
|
||||
*/
|
||||
public function test_get_action_events_by_courses_with_search() {
|
||||
public function test_get_action_events_by_courses_with_search(): void {
|
||||
// Generate data.
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$course1 = $this->getDataGenerator()->create_course();
|
||||
|
@ -54,7 +54,7 @@ class std_proxy_test extends \advanced_testcase {
|
||||
* @param string $member Object member to retrieve.
|
||||
* @param mixed $expected Expected value of member.
|
||||
*/
|
||||
public function test_proxy($id, $member, $expected) {
|
||||
public function test_proxy($id, $member, $expected): void {
|
||||
$proxy = new std_proxy($id, function($id) {
|
||||
return $this->objects[$id];
|
||||
});
|
||||
@ -70,7 +70,7 @@ class std_proxy_test extends \advanced_testcase {
|
||||
* @param string $member Object member to retrieve.
|
||||
* @param mixed $storedvalue Value as would be stored externally.
|
||||
*/
|
||||
public function test_base_values($id, $member, $storedvalue) {
|
||||
public function test_base_values($id, $member, $storedvalue): void {
|
||||
$proxy = new std_proxy(
|
||||
$id,
|
||||
function($id) {
|
||||
@ -89,7 +89,7 @@ class std_proxy_test extends \advanced_testcase {
|
||||
* @dataProvider get_set_testcases
|
||||
* @param int $id ID of the object being proxied.
|
||||
*/
|
||||
public function test_get_invalid_member($id) {
|
||||
public function test_get_invalid_member($id): void {
|
||||
$proxy = new std_proxy($id, function($id) {
|
||||
return $this->objects[$id];
|
||||
});
|
||||
@ -104,7 +104,7 @@ class std_proxy_test extends \advanced_testcase {
|
||||
* @dataProvider get_set_testcases
|
||||
* @param int $id Object ID.
|
||||
*/
|
||||
public function test_get_proxied_instance($id) {
|
||||
public function test_get_proxied_instance($id): void {
|
||||
$proxy = new std_proxy($id, function($id) {
|
||||
return $this->objects[$id];
|
||||
});
|
||||
|
@ -1999,7 +1999,7 @@ class provider_test extends provider_testcase {
|
||||
$this->assert_exported_comments(['Hi.'], $data->comments);
|
||||
}
|
||||
|
||||
public function test_export_data_for_user_with_related_competencies() {
|
||||
public function test_export_data_for_user_with_related_competencies(): void {
|
||||
$path = [
|
||||
get_string('competencies', 'core_competency'),
|
||||
get_string('privacy:path:relatedtome', 'core_competency'),
|
||||
|
@ -387,7 +387,7 @@ class restore_test extends \advanced_testcase {
|
||||
$this->assertEquals($startdate, $c2->startdate);
|
||||
}
|
||||
|
||||
public function test_restore_course_with_users() {
|
||||
public function test_restore_course_with_users(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
@ -39,7 +39,7 @@ class caching_content_item_readonly_repository_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test verifying that content items are cached and returned from the cache in subsequent same-request calls.
|
||||
*/
|
||||
public function test_find_all_for_course() {
|
||||
public function test_find_all_for_course(): void {
|
||||
$this->resetAfterTest();
|
||||
global $DB;
|
||||
|
||||
|
@ -751,7 +751,7 @@ class category_test extends \advanced_testcase {
|
||||
$CFG->coursecontact = $oldcoursecontact;
|
||||
}
|
||||
|
||||
public function test_course_contacts_with_duplicates() {
|
||||
public function test_course_contacts_with_duplicates(): void {
|
||||
global $DB, $CFG;
|
||||
|
||||
set_config('coursecontactduplicates', true);
|
||||
|
@ -76,7 +76,7 @@ class content_item_readonly_repository_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test confirming that all content items can be fetched, even those which require certain caps when in a course.
|
||||
*/
|
||||
public function test_find_all() {
|
||||
public function test_find_all(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
global $DB, $CFG;
|
||||
|
@ -4582,7 +4582,7 @@ class courselib_test extends advanced_testcase {
|
||||
* @param array $coursesdata Courses to create
|
||||
* @param array $expected Expected test results.
|
||||
*/
|
||||
public function test_course_classify_courses_for_timeline($coursesdata, $expected) {
|
||||
public function test_course_classify_courses_for_timeline($coursesdata, $expected): void {
|
||||
$this->resetAfterTest();
|
||||
$generator = $this->getDataGenerator();
|
||||
|
||||
@ -4723,7 +4723,7 @@ class courselib_test extends advanced_testcase {
|
||||
$offset,
|
||||
$expecteddbqueries,
|
||||
$expectedresult
|
||||
) {
|
||||
): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@ -4908,7 +4908,7 @@ class courselib_test extends advanced_testcase {
|
||||
/**
|
||||
* Test the course_get_enrolled_courses_for_logged_in_user_from_search function.
|
||||
*/
|
||||
public function test_course_get_enrolled_courses_for_logged_in_user_from_search() {
|
||||
public function test_course_get_enrolled_courses_for_logged_in_user_from_search(): void {
|
||||
global $DB;
|
||||
|
||||
// Set up.
|
||||
@ -5021,7 +5021,7 @@ class courselib_test extends advanced_testcase {
|
||||
$offset,
|
||||
$expectedcourses,
|
||||
$expectedprocessedcount
|
||||
) {
|
||||
): void {
|
||||
$this->resetAfterTest();
|
||||
$generator = $this->getDataGenerator();
|
||||
|
||||
@ -5242,7 +5242,7 @@ class courselib_test extends advanced_testcase {
|
||||
$offset,
|
||||
$expectedcourses,
|
||||
$expectedprocessedcount
|
||||
) {
|
||||
): void {
|
||||
$this->resetAfterTest();
|
||||
$generator = $this->getDataGenerator();
|
||||
|
||||
@ -5487,7 +5487,7 @@ class courselib_test extends advanced_testcase {
|
||||
$expectedcourses,
|
||||
$expectedprocessedcount,
|
||||
$hiddencourse
|
||||
) {
|
||||
): void {
|
||||
$this->resetAfterTest();
|
||||
$generator = $this->getDataGenerator();
|
||||
$student = $generator->create_user();
|
||||
@ -6983,7 +6983,7 @@ class courselib_test extends advanced_testcase {
|
||||
$enrolmentmethods,
|
||||
$enrolled,
|
||||
$expected
|
||||
) {
|
||||
): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
@ -3747,7 +3747,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
$expectednextoffset,
|
||||
$expectedexception = null,
|
||||
$searchvalue = null
|
||||
) {
|
||||
): void {
|
||||
$this->resetAfterTest();
|
||||
$generator = $this->getDataGenerator();
|
||||
|
||||
@ -3979,7 +3979,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Verify that content items can be added to user favourites.
|
||||
*/
|
||||
public function test_add_content_item_to_user_favourites() {
|
||||
public function test_add_content_item_to_user_favourites(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
@ -4017,7 +4017,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Verify that content items can be removed from user favourites.
|
||||
*/
|
||||
public function test_remove_content_item_from_user_favourites() {
|
||||
public function test_remove_content_item_from_user_favourites(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
@ -4057,7 +4057,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test the web service returning course content items for inclusion in activity choosers, etc.
|
||||
*/
|
||||
public function test_get_course_content_items() {
|
||||
public function test_get_course_content_items(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$course = self::getDataGenerator()->create_course();
|
||||
|
@ -98,7 +98,7 @@ class published_resource_repository_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers ::find_all_for_user
|
||||
*/
|
||||
public function test_find_all_for_user() {
|
||||
public function test_find_all_for_user(): void {
|
||||
$this->resetAfterTest();
|
||||
[$user, $user2, $user3, $course, $course2, $mod, $mod2, $mod3, $mod4] = $this->generate_published_resources();
|
||||
|
||||
@ -131,7 +131,7 @@ class published_resource_repository_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers ::find_all_by_ids_for_user
|
||||
*/
|
||||
public function test_find_all_by_ids_for_user() {
|
||||
public function test_find_all_by_ids_for_user(): void {
|
||||
$this->resetAfterTest();
|
||||
[$user, $user2, $user3, $course, $course2, $mod, $mod2, $mod3, $mod4, $coursetool, $tool, $tool2, $tool3, $tool4] =
|
||||
$this->generate_published_resources();
|
||||
|
@ -167,7 +167,7 @@ class resource_link_repository_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers ::find_by_resource
|
||||
*/
|
||||
public function test_find_by_resource() {
|
||||
public function test_find_by_resource(): void {
|
||||
$this->resetAfterTest();
|
||||
$resourcelink = $this->generate_resource_link();
|
||||
$repository = new resource_link_repository();
|
||||
@ -196,7 +196,7 @@ class resource_link_repository_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers ::find_by_resource_and_user
|
||||
*/
|
||||
public function test_find_by_resource_and_user() {
|
||||
public function test_find_by_resource_and_user(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
$resourcelink = $this->generate_resource_link();
|
||||
|
@ -726,7 +726,7 @@ class sync_members_test extends \lti_advantage_testcase {
|
||||
* @covers ::execute
|
||||
*/
|
||||
public function test_sync_enrolments_and_migration(?array $legacydata, ?array $resourceconfig, array $launchdata,
|
||||
?array $syncmembers, array $expected) {
|
||||
?array $syncmembers, array $expected): void {
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
@ -743,7 +743,7 @@ class sync_tool_grades_test extends \lti_advantage_testcase {
|
||||
*
|
||||
* @covers ::execute
|
||||
*/
|
||||
public function test_sync_grades_coupled_lineitem() {
|
||||
public function test_sync_grades_coupled_lineitem(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
[$course, $resource] = $this->create_test_environment();
|
||||
@ -817,7 +817,7 @@ class sync_tool_grades_test extends \lti_advantage_testcase {
|
||||
*
|
||||
* @covers ::execute
|
||||
*/
|
||||
public function test_sync_grades_none_or_many_lineitems_activity_context() {
|
||||
public function test_sync_grades_none_or_many_lineitems_activity_context(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
[$course, $resource] = $this->create_test_environment();
|
||||
@ -894,7 +894,7 @@ class sync_tool_grades_test extends \lti_advantage_testcase {
|
||||
*
|
||||
* @covers ::execute
|
||||
*/
|
||||
public function test_sync_grades_none_or_many_lineitems_course_context() {
|
||||
public function test_sync_grades_none_or_many_lineitems_course_context(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
[$course, $tool1, $tool2, $resource] = $this->create_test_environment();
|
||||
|
@ -1308,7 +1308,7 @@ class enrollib_test extends advanced_testcase {
|
||||
$limit,
|
||||
$offset,
|
||||
$expectedcourses
|
||||
) {
|
||||
): void {
|
||||
global $DB, $CFG;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
@ -533,7 +533,7 @@ EOD;
|
||||
*
|
||||
* @covers ::add_sql_debugging
|
||||
*/
|
||||
public function test_sql_debugging_anon_class() {
|
||||
public function test_sql_debugging_anon_class(): void {
|
||||
global $CFG;
|
||||
$CFG->debugsqltrace = 100;
|
||||
|
||||
|
@ -109,7 +109,7 @@ class file_browser_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test "Server files" from the system context
|
||||
*/
|
||||
public function test_file_info_context_system() {
|
||||
public function test_file_info_context_system(): void {
|
||||
|
||||
// There is one non-empty category child and two category children.
|
||||
|
||||
@ -126,7 +126,7 @@ class file_browser_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test "Server files" from the system context, hide Misc category
|
||||
*/
|
||||
public function test_file_info_context_system_hidden() {
|
||||
public function test_file_info_context_system_hidden(): void {
|
||||
|
||||
// Hide the course category that contains our two courses. Teacher does not have cap to view hidden categories.
|
||||
\core_course_category::get($this->course1->category)->update(['visible' => 0]);
|
||||
@ -153,7 +153,7 @@ class file_browser_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test "Server files" from the course category context
|
||||
*/
|
||||
public function test_file_info_context_coursecat() {
|
||||
public function test_file_info_context_coursecat(): void {
|
||||
|
||||
// There are two non-empty courses.
|
||||
|
||||
@ -183,7 +183,7 @@ class file_browser_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test "Server files" from the course context (course1)
|
||||
*/
|
||||
public function test_file_info_context_course_1() {
|
||||
public function test_file_info_context_course_1(): void {
|
||||
|
||||
$browser = get_file_browser();
|
||||
$fileinfo = $browser->get_file_info(\context_course::instance($this->course1->id));
|
||||
@ -214,7 +214,7 @@ class file_browser_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test "Server files" from the course context (course1)
|
||||
*/
|
||||
public function test_file_info_context_course_2() {
|
||||
public function test_file_info_context_course_2(): void {
|
||||
|
||||
// 2. Start from the course level.
|
||||
$browser = get_file_browser();
|
||||
|
@ -540,7 +540,7 @@ class file_storage_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers ::get_area_files
|
||||
*/
|
||||
public function test_get_area_files() {
|
||||
public function test_get_area_files(): void {
|
||||
$user = $this->setup_three_private_files();
|
||||
$fs = get_file_storage();
|
||||
|
||||
|
@ -273,7 +273,7 @@ class filetypes_util_test extends advanced_testcase {
|
||||
/**
|
||||
* Test populating the tree for the browser.
|
||||
*/
|
||||
public function test_data_for_browser() {
|
||||
public function test_data_for_browser(): void {
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
$util = new filetypes_util();
|
||||
|
@ -771,7 +771,7 @@ class phpunit_dataset_test extends advanced_testcase {
|
||||
* @dataProvider to_database_provider
|
||||
* @covers ::to_database
|
||||
*/
|
||||
public function test_to_database(array $files, ?array $filter, ?string $exception, array $columns, array $rows) {
|
||||
public function test_to_database(array $files, ?array $filter, ?string $exception, array $columns, array $rows): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
@ -448,7 +448,7 @@ class authlib_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the {@link signup_validate_data()} duplicate email validation.
|
||||
*/
|
||||
public function test_signup_validate_data_same_email() {
|
||||
public function test_signup_validate_data_same_email(): void {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/authlib.php');
|
||||
require_once($CFG->libdir . '/phpmailer/moodle_phpmailer.php');
|
||||
|
@ -58,7 +58,7 @@ class core_media_player_native_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test method list_supported_urls
|
||||
*/
|
||||
public function test_list_supported_urls() {
|
||||
public function test_list_supported_urls(): void {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/filelib.php');
|
||||
$nativeextensions = file_get_typegroup('extension', ['html_video', 'html_audio']);
|
||||
|
@ -37,7 +37,7 @@ class curl_security_helper_test extends \advanced_testcase {
|
||||
* @param bool $expected the expected result.
|
||||
* @dataProvider curl_security_url_data_provider
|
||||
*/
|
||||
public function test_curl_security_helper_url_is_blocked($dns, $url, $blockedhosts, $allowedports, $expected) {
|
||||
public function test_curl_security_helper_url_is_blocked($dns, $url, $blockedhosts, $allowedports, $expected): void {
|
||||
$this->resetAfterTest(true);
|
||||
$helper = $this->getMockBuilder('\core\files\curl_security_helper')
|
||||
->onlyMethods(['get_host_list_by_name'])
|
||||
|
@ -2050,7 +2050,7 @@ class grouplib_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers \groups_get_my_groups()
|
||||
*/
|
||||
public function test_get_my_groups_with_visibility() {
|
||||
public function test_get_my_groups_with_visibility(): void {
|
||||
list($users, $groups) = $this->create_groups_with_visibilty();
|
||||
|
||||
// Assign users to groups.
|
||||
|
@ -54,7 +54,7 @@ class primary_test extends \advanced_testcase {
|
||||
* otherwise consider the user as non-logged in
|
||||
* @param array $expecteditems An array of nodes expected with content in them.
|
||||
*/
|
||||
public function test_primary_export(bool $withcustom, bool $withlang, string $userloggedin, array $expecteditems) {
|
||||
public function test_primary_export(bool $withcustom, bool $withlang, string $userloggedin, array $expecteditems): void {
|
||||
global $PAGE, $CFG;
|
||||
if ($withcustom) {
|
||||
$CFG->custommenuitems = "Course search|/course/search.php
|
||||
|
@ -140,7 +140,7 @@ class mustache_helper_collection_test extends \advanced_testcase {
|
||||
* Any allowed helper should still be available to call during the
|
||||
* execution of a helper.
|
||||
*/
|
||||
public function test_disallowed_helpers_disabled_during_execution() {
|
||||
public function test_disallowed_helpers_disabled_during_execution(): void {
|
||||
$engine = new \Mustache_Engine();
|
||||
$context = new \Mustache_Context();
|
||||
$lambdahelper = new \Mustache_LambdaHelper($engine, $context);
|
||||
|
@ -695,7 +695,7 @@ class questionlib_test extends \advanced_testcase {
|
||||
* get_question_options includes the tags and course tags for all questions in the list
|
||||
* if each question has course and question level tags.
|
||||
*/
|
||||
public function test_get_question_options_includes_question_and_course_tags() {
|
||||
public function test_get_question_options_includes_question_and_course_tags(): void {
|
||||
list($category, $course, $quiz, $qcat, $questions) = $this->setup_quiz_and_questions('category');
|
||||
$question1 = $questions[0];
|
||||
$question2 = $questions[1];
|
||||
|
@ -212,7 +212,7 @@ class database_logger_test extends \advanced_testcase {
|
||||
* @dataProvider delete_task_logs_provider
|
||||
* @param mixed $ids
|
||||
*/
|
||||
public function test_delete_task_logs($ids) {
|
||||
public function test_delete_task_logs($ids): void {
|
||||
$DB = $this->mock_database();
|
||||
$DB->expects($this->once())
|
||||
->method('delete_records_list')
|
||||
|
@ -383,7 +383,7 @@ class login_lib_test extends \advanced_testcase {
|
||||
*
|
||||
* Email addresses should be handled as case-insensitive but accent sensitive.
|
||||
*/
|
||||
public function test_core_login_process_password_reset_email_sensitivity() {
|
||||
public function test_core_login_process_password_reset_email_sensitivity(): void {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir.'/phpmailer/moodle_phpmailer.php');
|
||||
|
||||
|
@ -70,7 +70,7 @@ class player_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test method list_supported_urls()
|
||||
*/
|
||||
public function test_list_supported_urls() {
|
||||
public function test_list_supported_urls(): void {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/filelib.php');
|
||||
|
||||
|
@ -67,7 +67,7 @@ class player_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test method list_supported_urls()
|
||||
*/
|
||||
public function test_list_supported_urls() {
|
||||
public function test_list_supported_urls(): void {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/filelib.php');
|
||||
|
||||
|
@ -1277,7 +1277,7 @@ class api_test extends messagelib_test {
|
||||
/**
|
||||
* Test verifying get_conversations identifies if a conversation is muted or not.
|
||||
*/
|
||||
public function test_get_conversations_some_muted() {
|
||||
public function test_get_conversations_some_muted(): void {
|
||||
// Create some users.
|
||||
$user1 = self::getDataGenerator()->create_user();
|
||||
$user2 = self::getDataGenerator()->create_user();
|
||||
@ -5749,7 +5749,7 @@ class api_test extends messagelib_test {
|
||||
$expectedcounts,
|
||||
$expectedunreadcounts,
|
||||
$deletedusers
|
||||
) {
|
||||
): void {
|
||||
$generator = $this->getDataGenerator();
|
||||
$users = [
|
||||
$generator->create_user(),
|
||||
@ -5872,7 +5872,7 @@ class api_test extends messagelib_test {
|
||||
$expectedcounts,
|
||||
$expectedunreadcounts,
|
||||
$deletedusers
|
||||
) {
|
||||
): void {
|
||||
$this->resetAfterTest();
|
||||
$generator = $this->getDataGenerator();
|
||||
$users = [
|
||||
|
@ -2032,7 +2032,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
* If checks this by placing some users in the same course, where default caps would permit a user to view another user's
|
||||
* profile.
|
||||
*/
|
||||
public function test_message_search_users_messagingallusers_disabled() {
|
||||
public function test_message_search_users_messagingallusers_disabled(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@ -2128,7 +2128,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
* This test verifies that any contacts are returned, as well as any non-contacts, regardless of whether the searching user
|
||||
* can view their respective profile.
|
||||
*/
|
||||
public function test_message_search_users_messagingallusers_enabled() {
|
||||
public function test_message_search_users_messagingallusers_enabled(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@ -4395,7 +4395,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test verifying get_conversations identifies if a conversation is muted or not.
|
||||
*/
|
||||
public function test_get_conversations_some_muted() {
|
||||
public function test_get_conversations_some_muted(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create some users.
|
||||
@ -5518,7 +5518,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
$expectedcounts,
|
||||
$expectedunreadcounts,
|
||||
$deletedusers
|
||||
) {
|
||||
): void {
|
||||
$this->resetAfterTest();
|
||||
$generator = $this->getDataGenerator();
|
||||
$users = [
|
||||
@ -5615,7 +5615,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
$expectedcounts,
|
||||
$expectedunreadcounts,
|
||||
$deletedusers
|
||||
) {
|
||||
): void {
|
||||
$this->resetAfterTest();
|
||||
$generator = $this->getDataGenerator();
|
||||
$users = [
|
||||
|
@ -1048,7 +1048,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Test for provider::delete_data_for_user().
|
||||
*/
|
||||
public function test_delete_data_for_user() {
|
||||
public function test_delete_data_for_user(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@ -1382,7 +1382,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Test for provider::delete_data_for_users().
|
||||
*/
|
||||
public function test_delete_data_for_users() {
|
||||
public function test_delete_data_for_users(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@ -1866,7 +1866,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Test for provider::delete_conversations_for_all_users().
|
||||
*/
|
||||
public function test_delete_conversations_for_all_users() {
|
||||
public function test_delete_conversations_for_all_users(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@ -2391,7 +2391,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Test for provider::delete_conversations_for_user().
|
||||
*/
|
||||
public function test_delete_conversations_for_user() {
|
||||
public function test_delete_conversations_for_user(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@ -2589,7 +2589,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Test for provider::delete_conversations_for_users().
|
||||
*/
|
||||
public function test_delete_conversations_for_users() {
|
||||
public function test_delete_conversations_for_users(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
@ -69,7 +69,7 @@ class start_submission_test extends \mod_assign\externallib_advanced_testcase {
|
||||
/**
|
||||
* Test start_submission if assignment cut off date has elapsed.
|
||||
*/
|
||||
public function test_start_submission_when_assignment_past_due_date() {
|
||||
public function test_start_submission_when_assignment_past_due_date(): void {
|
||||
$fiveminago = time() - 300;
|
||||
list($assign, $instance, $student1, $student2, $teacher, $g1, $g2) = $this->create_submission_for_testing_status(
|
||||
false, ['cutoffdate' => $fiveminago]);
|
||||
@ -87,7 +87,7 @@ class start_submission_test extends \mod_assign\externallib_advanced_testcase {
|
||||
/**
|
||||
* Test start_submission if time limit is disabled.
|
||||
*/
|
||||
public function test_start_submission_when_time_limit_disabled() {
|
||||
public function test_start_submission_when_time_limit_disabled(): void {
|
||||
list($assign, $instance, $student1, $student2, $teacher, $g1, $g2) = $this->create_submission_for_testing_status();
|
||||
$result = start_submission::execute($instance->id);
|
||||
$filteredwarnings = array_filter($result['warnings'], function($warning) {
|
||||
@ -103,7 +103,7 @@ class start_submission_test extends \mod_assign\externallib_advanced_testcase {
|
||||
/**
|
||||
* Test start_submission if time limit is not set for assignment.
|
||||
*/
|
||||
public function test_start_submission_when_time_limit_not_set() {
|
||||
public function test_start_submission_when_time_limit_not_set(): void {
|
||||
set_config('enabletimelimit', '1', 'assign');
|
||||
list($assign, $instance, $student1, $student2, $teacher, $g1, $g2) = $this->create_submission_for_testing_status();
|
||||
$result = start_submission::execute($instance->id);
|
||||
@ -120,7 +120,7 @@ class start_submission_test extends \mod_assign\externallib_advanced_testcase {
|
||||
/**
|
||||
* Test start_submission if user already has open submission.
|
||||
*/
|
||||
public function test_start_submission_when_submission_already_open() {
|
||||
public function test_start_submission_when_submission_already_open(): void {
|
||||
global $DB;
|
||||
set_config('enabletimelimit', '1', 'assign');
|
||||
list($assign, $instance, $student1, $student2, $teacher, $g1, $g2) = $this->create_submission_for_testing_status(
|
||||
@ -142,7 +142,7 @@ class start_submission_test extends \mod_assign\externallib_advanced_testcase {
|
||||
/**
|
||||
* Test start_submission if user has already submitted with no additional attempts available.
|
||||
*/
|
||||
public function test_start_submission_with_no_attempts_available() {
|
||||
public function test_start_submission_with_no_attempts_available(): void {
|
||||
global $DB;
|
||||
set_config('enabletimelimit', '1', 'assign');
|
||||
list($assign, $instance, $student1, $student2, $teacher, $g1, $g2) = $this->create_submission_for_testing_status(
|
||||
|
@ -332,7 +332,7 @@ class externallib_test extends \mod_assign\externallib_advanced_testcase {
|
||||
/**
|
||||
* Test get_assignments with submissionstatement.
|
||||
*/
|
||||
public function test_get_assignments_with_submissionstatement() {
|
||||
public function test_get_assignments_with_submissionstatement(): void {
|
||||
global $DB, $USER, $CFG;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
@ -1377,7 +1377,7 @@ class lib_test extends \advanced_testcase {
|
||||
* able to update the assignment due date by changing the due date calendar
|
||||
* event.
|
||||
*/
|
||||
public function test_teacher_role_can_update_due_event() {
|
||||
public function test_teacher_role_can_update_due_event(): void {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . '/calendar/lib.php');
|
||||
|
||||
|
@ -379,7 +379,7 @@ class get_recordings_test extends \externallib_advanced_testcase {
|
||||
* @covers \mod_bigbluebuttonbn\external\get_recordings::execute
|
||||
* @dataProvider recording_group_test_data
|
||||
*/
|
||||
public function test_get_recordings_groups($type, $groups, $users, $recordingsdata, $test, $coursemode) {
|
||||
public function test_get_recordings_groups($type, $groups, $users, $recordingsdata, $test, $coursemode): void {
|
||||
$this->resetAfterTest();
|
||||
$dataset = compact('type', 'groups', 'users', 'recordingsdata', 'test', 'coursemode');
|
||||
$activityid = $this->create_from_dataset($dataset);
|
||||
|
@ -130,7 +130,7 @@ class lib_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers ::bigbluebuttonbn_delete_instance
|
||||
*/
|
||||
public function test_bigbluebuttonbn_delete_instance_with_running_group_meetings() {
|
||||
public function test_bigbluebuttonbn_delete_instance_with_running_group_meetings(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->initialise_mock_server();
|
||||
$datagenerator = $this->getDataGenerator();
|
||||
@ -224,7 +224,7 @@ class lib_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers ::bigbluebuttonbn_get_recent_mod_activity
|
||||
*/
|
||||
public function test_bigbluebuttonbn_get_recent_mod_activity() {
|
||||
public function test_bigbluebuttonbn_get_recent_mod_activity(): void {
|
||||
$this->initialise_mock_server();
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
@ -37,7 +37,7 @@ class recording_proxy_test extends \advanced_testcase {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_fetch_recordings() {
|
||||
public function test_fetch_recordings(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->initialise_mock_server();
|
||||
[$context, $cm, $bbbactivity] = $this->create_instance();
|
||||
@ -55,7 +55,7 @@ class recording_proxy_test extends \advanced_testcase {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_fetch_recordings_breakoutroom() {
|
||||
public function test_fetch_recordings_breakoutroom(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->initialise_mock_server();
|
||||
[$context, $cm, $bbbactivity] = $this->create_instance();
|
||||
|
@ -95,7 +95,7 @@ class recording_row_playback_test extends \advanced_testcase {
|
||||
* @covers \recording_row_playback::should_be_included
|
||||
* @dataProvider should_be_included_data_provider
|
||||
*/
|
||||
public function test_should_be_included(string $role, array $canview, object $globalsettings = null) {
|
||||
public function test_should_be_included(string $role, array $canview, object $globalsettings = null): void {
|
||||
global $PAGE;
|
||||
$this->resetAfterTest();
|
||||
['recordings' => $recordingsdata, 'activity' => $activity] = $this->create_activity_with_recordings(
|
||||
|
@ -889,7 +889,7 @@ class lib_test extends \externallib_advanced_testcase {
|
||||
* A CHOICE_EVENT_TYPE_OPEN event should update the timeopen property of
|
||||
* the choice activity.
|
||||
*/
|
||||
public function test_mod_choice_core_calendar_event_timestart_updated_open_event() {
|
||||
public function test_mod_choice_core_calendar_event_timestart_updated_open_event(): void {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . "/calendar/lib.php");
|
||||
|
||||
@ -950,7 +950,7 @@ class lib_test extends \externallib_advanced_testcase {
|
||||
* A CHOICE_EVENT_TYPE_CLOSE event should update the timeclose property of
|
||||
* the choice activity.
|
||||
*/
|
||||
public function test_mod_choice_core_calendar_event_timestart_updated_close_event() {
|
||||
public function test_mod_choice_core_calendar_event_timestart_updated_close_event(): void {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . "/calendar/lib.php");
|
||||
|
||||
|
@ -1706,7 +1706,7 @@ class lib_test extends \advanced_testcase {
|
||||
/**
|
||||
* A DATA_EVENT_TYPE_OPEN event should update the timeavailablefrom property of the data activity.
|
||||
*/
|
||||
public function test_mod_data_core_calendar_event_timestart_updated_open_event() {
|
||||
public function test_mod_data_core_calendar_event_timestart_updated_open_event(): void {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . "/calendar/lib.php");
|
||||
|
||||
@ -1763,7 +1763,7 @@ class lib_test extends \advanced_testcase {
|
||||
/**
|
||||
* A DATA_EVENT_TYPE_CLOSE event should update the timeavailableto property of the data activity.
|
||||
*/
|
||||
public function test_mod_data_core_calendar_event_timestart_updated_close_event() {
|
||||
public function test_mod_data_core_calendar_event_timestart_updated_close_event(): void {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . "/calendar/lib.php");
|
||||
|
||||
|
@ -222,7 +222,7 @@ class manager_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers ::get_available_presets
|
||||
*/
|
||||
public function test_get_available_presets() {
|
||||
public function test_get_available_presets(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@ -323,7 +323,7 @@ class manager_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers ::get_available_plugin_presets
|
||||
*/
|
||||
public function test_get_available_plugin_presets() {
|
||||
public function test_get_available_plugin_presets(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
@ -369,7 +369,7 @@ class manager_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers ::get_available_saved_presets
|
||||
*/
|
||||
public function test_get_available_saved_presets() {
|
||||
public function test_get_available_saved_presets(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
@ -208,7 +208,7 @@ class preset_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers ::save
|
||||
*/
|
||||
public function test_save_new_preset() {
|
||||
public function test_save_new_preset(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
|
@ -1076,7 +1076,7 @@ class lib_test extends \advanced_testcase {
|
||||
* The activity should update if a teacher modifies the calendar
|
||||
* event.
|
||||
*/
|
||||
public function test_teacher_role_can_update_time_close_event() {
|
||||
public function test_teacher_role_can_update_time_close_event(): void {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . '/calendar/lib.php');
|
||||
|
||||
|
@ -142,7 +142,7 @@ class builders_exported_posts_test extends \advanced_testcase {
|
||||
* Test the build function returns the exported posts in the order that the posts are
|
||||
* given.
|
||||
*/
|
||||
public function test_build_returns_posts_in_order() {
|
||||
public function test_build_returns_posts_in_order(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$datagenerator = $this->getDataGenerator();
|
||||
@ -185,7 +185,7 @@ class builders_exported_posts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the build function loads authors.
|
||||
*/
|
||||
public function test_build_loads_authors() {
|
||||
public function test_build_loads_authors(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$datagenerator = $this->getDataGenerator();
|
||||
@ -230,7 +230,7 @@ class builders_exported_posts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the build function loads attachments.
|
||||
*/
|
||||
public function test_build_loads_attachments() {
|
||||
public function test_build_loads_attachments(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$datagenerator = $this->getDataGenerator();
|
||||
@ -306,7 +306,7 @@ class builders_exported_posts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the build function loads author groups.
|
||||
*/
|
||||
public function test_build_loads_author_groups() {
|
||||
public function test_build_loads_author_groups(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$datagenerator = $this->getDataGenerator();
|
||||
@ -376,7 +376,7 @@ class builders_exported_posts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the build function loads tags.
|
||||
*/
|
||||
public function test_build_loads_tags() {
|
||||
public function test_build_loads_tags(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$datagenerator = $this->getDataGenerator();
|
||||
@ -437,7 +437,7 @@ class builders_exported_posts_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the build function loads read_receipts.
|
||||
*/
|
||||
public function test_build_loads_read_receipts() {
|
||||
public function test_build_loads_read_receipts(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$datagenerator = $this->getDataGenerator();
|
||||
|
@ -29,7 +29,7 @@ class entities_sorter_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the entity returns expected values.
|
||||
*/
|
||||
public function test_entity_sort_into_children() {
|
||||
public function test_entity_sort_into_children(): void {
|
||||
$this->resetAfterTest();
|
||||
$sorter = new sorter_entity(
|
||||
function($entity) {
|
||||
@ -59,7 +59,7 @@ class entities_sorter_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the entity returns expected values.
|
||||
*/
|
||||
public function test_entity_flatten_children() {
|
||||
public function test_entity_flatten_children(): void {
|
||||
$this->resetAfterTest();
|
||||
$sorter = new sorter_entity(
|
||||
function($entity) {
|
||||
|
@ -1063,7 +1063,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Ensure that all user data is deleted from a context.
|
||||
*/
|
||||
public function test_all_users_deleted_from_context() {
|
||||
public function test_all_users_deleted_from_context(): void {
|
||||
global $DB;
|
||||
|
||||
$fs = get_file_storage();
|
||||
@ -1268,7 +1268,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Ensure that all user data is deleted for a specific context.
|
||||
*/
|
||||
public function test_delete_data_for_user() {
|
||||
public function test_delete_data_for_user(): void {
|
||||
global $DB;
|
||||
|
||||
$fs = get_file_storage();
|
||||
@ -1483,7 +1483,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
|
||||
/**
|
||||
* Ensure that user data for specific users is deleted from a specified context.
|
||||
*/
|
||||
public function test_delete_data_for_users() {
|
||||
public function test_delete_data_for_users(): void {
|
||||
global $DB;
|
||||
|
||||
$fs = get_file_storage();
|
||||
|
@ -85,7 +85,7 @@ class vaults_forum_test extends \advanced_testcase {
|
||||
*
|
||||
* @covers ::get_from_course_module_ids
|
||||
*/
|
||||
public function test_get_from_course_module_ids() {
|
||||
public function test_get_from_course_module_ids(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$vaultfactory = \mod_forum\local\container::get_vault_factory();
|
||||
|
@ -48,7 +48,7 @@ class get_h5pactivities_by_courses_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test test_get_h5pactivities_by_courses user student.
|
||||
*/
|
||||
public function test_get_h5pactivities_by_courses() {
|
||||
public function test_get_h5pactivities_by_courses(): void {
|
||||
global $CFG, $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
@ -827,7 +827,7 @@ class lib_test extends \advanced_testcase {
|
||||
/**
|
||||
* A LESSON_EVENT_TYPE_OPEN event should update the available property of the lesson activity.
|
||||
*/
|
||||
public function test_mod_lesson_core_calendar_event_timestart_updated_open_event() {
|
||||
public function test_mod_lesson_core_calendar_event_timestart_updated_open_event(): void {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . "/calendar/lib.php");
|
||||
|
||||
@ -887,7 +887,7 @@ class lib_test extends \advanced_testcase {
|
||||
/**
|
||||
* A LESSON_EVENT_TYPE_CLOSE event should update the deadline property of the lesson activity.
|
||||
*/
|
||||
public function test_mod_lesson_core_calendar_event_timestart_updated_close_event() {
|
||||
public function test_mod_lesson_core_calendar_event_timestart_updated_close_event(): void {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . "/calendar/lib.php");
|
||||
$this->resetAfterTest(true);
|
||||
|
@ -273,7 +273,7 @@ class calendar_event_modified_test extends \advanced_testcase {
|
||||
* able to update the quiz activity dates by changing the calendar
|
||||
* event.
|
||||
*/
|
||||
public function test_teacher_role_can_update_quiz_activity() {
|
||||
public function test_teacher_role_can_update_quiz_activity(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
@ -226,7 +226,7 @@ class local_structure_slot_random_test extends \advanced_testcase {
|
||||
(array)json_decode($tagspropery)->filters->qtagids->values);
|
||||
}
|
||||
|
||||
public function test_insert() {
|
||||
public function test_insert(): void {
|
||||
global $SITE;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
@ -227,7 +227,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Test get scorm scoes
|
||||
*/
|
||||
public function test_mod_scorm_get_scorm_scoes() {
|
||||
public function test_mod_scorm_get_scorm_scoes(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
@ -633,7 +633,7 @@ class lib_test extends \advanced_testcase {
|
||||
* A SCORM_EVENT_TYPE_OPEN event should update the timeopen property of
|
||||
* the scorm activity.
|
||||
*/
|
||||
public function test_mod_scorm_core_calendar_event_timestart_updated_open_event() {
|
||||
public function test_mod_scorm_core_calendar_event_timestart_updated_open_event(): void {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . "/calendar/lib.php");
|
||||
|
||||
@ -694,7 +694,7 @@ class lib_test extends \advanced_testcase {
|
||||
* A SCORM_EVENT_TYPE_CLOSE event should update the timeclose property of
|
||||
* the scorm activity.
|
||||
*/
|
||||
public function test_mod_scorm_core_calendar_event_timestart_updated_close_event() {
|
||||
public function test_mod_scorm_core_calendar_event_timestart_updated_close_event(): void {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . "/calendar/lib.php");
|
||||
|
||||
|
@ -327,7 +327,7 @@ class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Export data for user 1
|
||||
*/
|
||||
public function test_export_user_data1() {
|
||||
public function test_export_user_data1(): void {
|
||||
|
||||
// Export all contexts for the first user.
|
||||
$contextids = array_values(array_map(function($c) {
|
||||
@ -383,7 +383,7 @@ class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Test export data for user 2
|
||||
*/
|
||||
public function test_export_user_data2() {
|
||||
public function test_export_user_data2(): void {
|
||||
|
||||
// Export all contexts for the second user.
|
||||
$contextids = array_values(array_map(function($c) {
|
||||
@ -434,7 +434,7 @@ class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Test export data for user 3 (locks, empty individual wiki)
|
||||
*/
|
||||
public function test_export_user_data3() {
|
||||
public function test_export_user_data3(): void {
|
||||
|
||||
// Export all contexts for the third user.
|
||||
$contextids = array_values(array_map(function($c) {
|
||||
@ -515,7 +515,7 @@ class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Test export data when there are comments.
|
||||
*/
|
||||
public function test_export_user_data_with_comments() {
|
||||
public function test_export_user_data_with_comments(): void {
|
||||
global $DB;
|
||||
// Comment on each page in the first wiki as the first user.
|
||||
$this->setUser($this->users[1]);
|
||||
|
@ -705,7 +705,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
||||
*
|
||||
* @covers ::export_user_preference
|
||||
*/
|
||||
public function test_export_user_preference_context_block_multiple_instances() {
|
||||
public function test_export_user_preference_context_block_multiple_instances(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = $this->getDataGenerator();
|
||||
@ -1323,7 +1323,7 @@ class moodle_content_writer_test extends advanced_testcase {
|
||||
];
|
||||
}
|
||||
|
||||
public function test_export_html_functions() {
|
||||
public function test_export_html_functions(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$data = (object) ['key' => 'value'];
|
||||
|
@ -195,7 +195,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
$includesubcategories,
|
||||
$usetagnames,
|
||||
$expectedquestionindexes
|
||||
) {
|
||||
): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$context = \context_system::instance();
|
||||
@ -365,7 +365,7 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
/**
|
||||
* get_random_question_summaries should allow limiting and offsetting of the result set.
|
||||
*/
|
||||
public function test_get_random_question_summaries_with_limit_and_offset() {
|
||||
public function test_get_random_question_summaries_with_limit_and_offset(): void {
|
||||
$this->resetAfterTest();
|
||||
$numberofquestions = 5;
|
||||
$includesubcategories = false;
|
||||
|
@ -64,7 +64,7 @@ class question_type_test extends \advanced_testcase {
|
||||
$this->assertEquals(0.1, $this->qtype->get_random_guess_score($q));
|
||||
}
|
||||
|
||||
public function test_load_question() {
|
||||
public function test_load_question(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$syscontext = \context_system::instance();
|
||||
|
@ -148,7 +148,7 @@ class question_type_test extends \advanced_testcase {
|
||||
$this->assertNull($this->qtype->get_random_guess_score($questiondata));
|
||||
}
|
||||
|
||||
public function test_load_question() {
|
||||
public function test_load_question(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$syscontext = \context_system::instance();
|
||||
|
@ -47,7 +47,7 @@ class search_test extends \advanced_testcase {
|
||||
* @param string $search The search string
|
||||
* @param array $expected The array containing the expected content names that should be returned by the search
|
||||
*/
|
||||
public function test_get_search_contents(array $contentnames, string $search, array $expected) {
|
||||
public function test_get_search_contents(array $contentnames, string $search, array $expected): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$admin = get_admin();
|
||||
|
@ -339,7 +339,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Some Dropbox endpoints require that the POSTFIELDS be set to null exactly.
|
||||
*/
|
||||
public function test_fetch_dropbox_data_postfields_null() {
|
||||
public function test_fetch_dropbox_data_postfields_null(): void {
|
||||
$mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods([
|
||||
@ -365,7 +365,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* When data is specified, it should be json_encoded in POSTFIELDS.
|
||||
*/
|
||||
public function test_fetch_dropbox_data_postfields_data() {
|
||||
public function test_fetch_dropbox_data_postfields_data(): void {
|
||||
$mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods([
|
||||
@ -442,7 +442,7 @@ class api_test extends \advanced_testcase {
|
||||
/**
|
||||
* Base tests for the fetch_dropbox_content function.
|
||||
*/
|
||||
public function test_fetch_dropbox_content() {
|
||||
public function test_fetch_dropbox_content(): void {
|
||||
$mock = $this->getMockBuilder(\repository_dropbox\dropbox::class)
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods([
|
||||
|
@ -250,7 +250,7 @@ class provider_test extends provider_testcase {
|
||||
$this->assertEquals(0, $DB->count_records('tag_instance', []));
|
||||
}
|
||||
|
||||
public function test_export_data_for_user() {
|
||||
public function test_export_data_for_user(): void {
|
||||
global $DB;
|
||||
list($user1, $user2) = $this->set_up_tags();
|
||||
$context = \context_system::instance();
|
||||
|
@ -325,7 +325,7 @@ class taglib_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test for function compute_correlations() that is part of tag cron
|
||||
*/
|
||||
public function test_correlations() {
|
||||
public function test_correlations(): void {
|
||||
global $DB;
|
||||
$task = new \core\task\tag_cron_task();
|
||||
|
||||
@ -929,7 +929,7 @@ class taglib_test extends \advanced_testcase {
|
||||
/**
|
||||
* Testing function core_tag_tag::combine_tags() when related tags are present.
|
||||
*/
|
||||
public function test_combine_tags_with_related() {
|
||||
public function test_combine_tags_with_related(): void {
|
||||
$collid = core_tag_collection::get_default();
|
||||
$context = \context_system::instance();
|
||||
core_tag_tag::set_item_tags('core', 'course', 10, $context, array('Cat', 'Cats', 'Dog'));
|
||||
@ -1014,7 +1014,7 @@ class taglib_test extends \advanced_testcase {
|
||||
* have instances in the given context even when there is only a single
|
||||
* instance.
|
||||
*/
|
||||
public function test_get_tags_by_area_in_contexts_single_tag_one_context() {
|
||||
public function test_get_tags_by_area_in_contexts_single_tag_one_context(): void {
|
||||
$tagnames = ['foo'];
|
||||
$collid = core_tag_collection::get_default();
|
||||
$tags = core_tag_tag::create_if_missing($collid, $tagnames);
|
||||
@ -1043,7 +1043,7 @@ class taglib_test extends \advanced_testcase {
|
||||
* that have tag instances in for the area in the given context and
|
||||
* should ignore all tags that don't have an instance.
|
||||
*/
|
||||
public function test_get_tags_by_area_in_contexts_multiple_tags_one_context() {
|
||||
public function test_get_tags_by_area_in_contexts_multiple_tags_one_context(): void {
|
||||
$tagnames = ['foo', 'bar', 'baz'];
|
||||
$collid = core_tag_collection::get_default();
|
||||
$tags = core_tag_tag::create_if_missing($collid, $tagnames);
|
||||
@ -1073,7 +1073,7 @@ class taglib_test extends \advanced_testcase {
|
||||
* Tags with tag instances in the same area with in difference contexts
|
||||
* should be ignored.
|
||||
*/
|
||||
public function test_get_tags_by_area_in_contexts_multiple_tags_multiple_contexts() {
|
||||
public function test_get_tags_by_area_in_contexts_multiple_tags_multiple_contexts(): void {
|
||||
$tagnames = ['foo', 'bar', 'baz', 'bop', 'bam', 'bip'];
|
||||
$collid = core_tag_collection::get_default();
|
||||
$tags = core_tag_tag::create_if_missing($collid, $tagnames);
|
||||
@ -1191,7 +1191,7 @@ class taglib_test extends \advanced_testcase {
|
||||
* 3 => []
|
||||
* ]
|
||||
*/
|
||||
public function test_get_items_tags_missing_itemids() {
|
||||
public function test_get_items_tags_missing_itemids(): void {
|
||||
$user1 = $this->getDataGenerator()->create_user();
|
||||
$user2 = $this->getDataGenerator()->create_user();
|
||||
$user3 = $this->getDataGenerator()->create_user();
|
||||
@ -1232,7 +1232,7 @@ class taglib_test extends \advanced_testcase {
|
||||
* set_item_tags should remove any tags that aren't in the given list and should
|
||||
* add any instances that are missing.
|
||||
*/
|
||||
public function test_set_item_tags_no_multiple_context_add_remove_instances() {
|
||||
public function test_set_item_tags_no_multiple_context_add_remove_instances(): void {
|
||||
$tagnames = ['foo', 'bar', 'baz', 'bop'];
|
||||
$collid = core_tag_collection::get_default();
|
||||
$tags = core_tag_tag::create_if_missing($collid, $tagnames);
|
||||
@ -1312,7 +1312,7 @@ class taglib_test extends \advanced_testcase {
|
||||
* the new set of tags, regardless of the context that the tag instance
|
||||
* is in.
|
||||
*/
|
||||
public function test_set_item_tags_no_multiple_contex_deletes_old_instancest() {
|
||||
public function test_set_item_tags_no_multiple_contex_deletes_old_instancest(): void {
|
||||
$tagnames = ['foo', 'bar', 'baz', 'bop'];
|
||||
$collid = core_tag_collection::get_default();
|
||||
$tags = core_tag_tag::create_if_missing($collid, $tagnames);
|
||||
@ -1361,7 +1361,7 @@ class taglib_test extends \advanced_testcase {
|
||||
* set_item_tags should not change tag instances in a different context to the one
|
||||
* it's opertating on if the tag area allows instances from multiple contexts.
|
||||
*/
|
||||
public function test_set_item_tags_allow_multiple_context_doesnt_update_context() {
|
||||
public function test_set_item_tags_allow_multiple_context_doesnt_update_context(): void {
|
||||
global $DB;
|
||||
$tagnames = ['foo', 'bar', 'bop'];
|
||||
$collid = core_tag_collection::get_default();
|
||||
@ -1414,7 +1414,7 @@ class taglib_test extends \advanced_testcase {
|
||||
* the new set of tags only in the same context if the tag area allows
|
||||
* multiple contexts.
|
||||
*/
|
||||
public function test_set_item_tags_allow_multiple_context_deletes_instances_in_same_context() {
|
||||
public function test_set_item_tags_allow_multiple_context_deletes_instances_in_same_context(): void {
|
||||
$tagnames = ['foo', 'bar', 'baz', 'bop'];
|
||||
$collid = core_tag_collection::get_default();
|
||||
$tags = core_tag_tag::create_if_missing($collid, $tagnames);
|
||||
@ -1458,7 +1458,7 @@ class taglib_test extends \advanced_testcase {
|
||||
* set_item_tags should allow multiple instances of the same tag in different
|
||||
* contexts if the tag area allows multiple contexts.
|
||||
*/
|
||||
public function test_set_item_tags_allow_multiple_context_same_tag_multiple_contexts() {
|
||||
public function test_set_item_tags_allow_multiple_context_same_tag_multiple_contexts(): void {
|
||||
$tagnames = ['foo'];
|
||||
$collid = core_tag_collection::get_default();
|
||||
$tags = core_tag_tag::create_if_missing($collid, $tagnames);
|
||||
@ -1788,7 +1788,7 @@ class taglib_test extends \advanced_testcase {
|
||||
* delete_instances should delete all tag instances for a component, item type
|
||||
* and context if given the component, itemtype, and context id as parameters.
|
||||
*/
|
||||
public function test_delete_instances_with_component_and_itemtype_and_context() {
|
||||
public function test_delete_instances_with_component_and_itemtype_and_context(): void {
|
||||
global $DB;
|
||||
|
||||
$tagnames = ['foo', 'bar', 'baz'];
|
||||
|
@ -984,7 +984,7 @@ class userlib_test extends \advanced_testcase {
|
||||
* Test user_get_user_details_groups.
|
||||
* @covers ::user_get_user_details
|
||||
*/
|
||||
public function test_user_get_user_details_groups() {
|
||||
public function test_user_get_user_details_groups(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create user and modify user profile.
|
||||
|
Loading…
x
Reference in New Issue
Block a user