Merge branch 'MDL-83472-405' of https://github.com/paulholden/moodle into MOODLE_405_STABLE

This commit is contained in:
Jun Pataleta 2024-10-22 15:55:54 +08:00
commit ef01def984
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7
8 changed files with 27 additions and 25 deletions

View File

@ -50,7 +50,7 @@ final class community_of_inquiry_activities_completed_by_test extends advanced_t
* @param string $availabilitylevel
* @return void
*/
public function test_get_activities_with_availability($availabilitylevel) {
public function test_get_activities_with_availability($availabilitylevel): void {
list($course, $stu1) = $this->setup_course();
@ -113,7 +113,7 @@ final class community_of_inquiry_activities_completed_by_test extends advanced_t
*
* @return void
*/
public function test_get_activities_with_weeks() {
public function test_get_activities_with_weeks(): void {
$startdate = gmmktime('0', '0', '0', 10, 24, 2015);
$record = array(
@ -156,7 +156,7 @@ final class community_of_inquiry_activities_completed_by_test extends advanced_t
*
* @return void
*/
public function test_get_activities_by_section() {
public function test_get_activities_by_section(): void {
// This makes debugging easier, sorry WA's +8 :).
$this->setTimezone('UTC');
@ -226,7 +226,7 @@ final class community_of_inquiry_activities_completed_by_test extends advanced_t
*
* @return void
*/
public function test_get_activities_with_specific_restrictions() {
public function test_get_activities_with_specific_restrictions(): void {
list($course, $stu1) = $this->setup_course();

View File

@ -39,7 +39,7 @@ final class course_module_instance_list_viewed_test extends advanced_testcase {
/**
* Test event properties and methods.
*/
public function test_event_attributes() {
public function test_event_attributes(): void {
$this->resetAfterTest();
$course = $this->getDataGenerator()->create_course();
@ -65,7 +65,7 @@ final class course_module_instance_list_viewed_test extends advanced_testcase {
/**
* Test custom validations of the event.
*/
public function test_event_validations() {
public function test_event_validations(): void {
try {
\mod_unittests\event\course_module_instance_list_viewed::create(array('context' => context_system::instance()));
$this->fail('Event validation should not allow course_module_instance_list_viewed event to be triggered without outside

View File

@ -39,7 +39,7 @@ final class course_module_viewed_test extends advanced_testcase {
/**
* Test event properties and methods.
*/
public function test_event_attributes() {
public function test_event_attributes(): void {
$this->resetAfterTest();
$course = $this->getDataGenerator()->create_course();
@ -71,7 +71,7 @@ final class course_module_viewed_test extends advanced_testcase {
/**
* Test custom validations of the event.
*/
public function test_event_validations() {
public function test_event_validations(): void {
// Make sure objecttable and object id is always set.
try {

View File

@ -39,7 +39,7 @@ final class delete_entry_test extends externallib_advanced_testcase {
/**
* Test the behaviour of delete_entry().
*/
public function test_delete_entry() {
public function test_delete_entry(): void {
global $DB;
$this->resetAfterTest();

View File

@ -39,7 +39,7 @@ final class prepare_entry_test extends externallib_advanced_testcase {
/**
* test_prepare_entry
*/
public function test_prepare_entry() {
public function test_prepare_entry(): void {
global $USER;
$this->resetAfterTest(true);

View File

@ -43,7 +43,7 @@ final class update_entry_test extends externallib_advanced_testcase {
/**
* test_update_entry_without_optional_settings
*/
public function test_update_entry_without_optional_settings() {
public function test_update_entry_without_optional_settings(): void {
global $CFG, $DB;
$this->resetAfterTest(true);
@ -78,7 +78,7 @@ final class update_entry_test extends externallib_advanced_testcase {
/**
* test_update_entry_duplicated
*/
public function test_update_entry_duplicated() {
public function test_update_entry_duplicated(): void {
global $CFG, $DB;
$this->resetAfterTest(true);
@ -115,7 +115,7 @@ final class update_entry_test extends externallib_advanced_testcase {
/**
* test_update_entry_with_aliases
*/
public function test_update_entry_with_aliases() {
public function test_update_entry_with_aliases(): void {
global $DB;
$this->resetAfterTest(true);
@ -152,7 +152,7 @@ final class update_entry_test extends externallib_advanced_testcase {
/**
* test_update_entry_in_categories
*/
public function test_update_entry_in_categories() {
public function test_update_entry_in_categories(): void {
global $DB;
$this->resetAfterTest(true);
@ -193,7 +193,7 @@ final class update_entry_test extends externallib_advanced_testcase {
/**
* test_update_entry_with_attachments
*/
public function test_update_entry_with_attachments() {
public function test_update_entry_with_attachments(): void {
global $DB, $USER;
$this->resetAfterTest(true);

View File

@ -37,7 +37,7 @@ final class userlist_collection_test extends advanced_testcase {
*
* @covers ::add_userlist
*/
public function test_supports_userlist() {
public function test_supports_userlist(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);
@ -52,7 +52,7 @@ final class userlist_collection_test extends advanced_testcase {
*
* @covers ::add_userlist
*/
public function test_supports_approved_userlist() {
public function test_supports_approved_userlist(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);
@ -67,7 +67,7 @@ final class userlist_collection_test extends advanced_testcase {
*
* @covers ::get_userlist_for_component
*/
public function test_get_userlist_for_component() {
public function test_get_userlist_for_component(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);
@ -88,7 +88,7 @@ final class userlist_collection_test extends advanced_testcase {
*
* @covers ::get_userlist_for_component
*/
public function test_get_userlist_for_component_not_found() {
public function test_get_userlist_for_component_not_found(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);
@ -100,7 +100,7 @@ final class userlist_collection_test extends advanced_testcase {
*
* @covers ::add_userlist
*/
public function test_duplicate_addition_throws() {
public function test_duplicate_addition_throws(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);
@ -116,7 +116,7 @@ final class userlist_collection_test extends advanced_testcase {
*
* @covers ::count
*/
public function test_countable() {
public function test_countable(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);
@ -135,7 +135,7 @@ final class userlist_collection_test extends advanced_testcase {
* @covers ::rewind
* @covers ::valid
*/
public function test_iteration() {
public function test_iteration(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);
@ -165,7 +165,7 @@ final class userlist_collection_test extends advanced_testcase {
*
* @covers ::get_context
*/
public function test_get_context() {
public function test_get_context(): void {
$cut = \context_system::instance();
$uut = new userlist_collection($cut);

View File

@ -39,6 +39,8 @@ final class report_progress_helper_test extends advanced_testcase {
public function setUp(): void {
global $CFG;
parent::setUp();
$CFG->enablecompletion = true;
$this->setAdminUser();
$this->resetAfterTest();
@ -48,7 +50,7 @@ final class report_progress_helper_test extends advanced_testcase {
/**
* Test process_activities_by_filter_options function.
*/
public function test_sort_activities() {
public function test_sort_activities(): void {
$expectedactivitytypes = ['all' => 'All activities and resources', 'assign' => 'Assignments', 'quiz' => 'Quizzes'];
// Generate test data.
@ -74,7 +76,7 @@ final class report_progress_helper_test extends advanced_testcase {
/**
* Test filtering by section.
*/
public function test_filter_activities_by_section() {
public function test_filter_activities_by_section(): void {
$course = $this->getDataGenerator()->create_course(array('enablecompletion' => 1));
$this->generator->create_module('quiz', ['course' => $course->id, 'name' => 'Quiz 2', 'section' => 1],
['completion' => 1]);