diff --git a/classes/enrol_coursecompleted_bulkdelete.php b/classes/enrol_coursecompleted_bulkdelete.php index 8dbaea7..7c5a468 100644 --- a/classes/enrol_coursecompleted_bulkdelete.php +++ b/classes/enrol_coursecompleted_bulkdelete.php @@ -37,7 +37,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class enrol_coursecompleted_bulkdelete extends enrol_bulk_enrolment_operation { - /** * Returns the identifier for this bulk operation. This is the key used when the plugin * returns an array containing all of the bulk operations it supports. diff --git a/classes/enrol_coursecompleted_bulkedit.php b/classes/enrol_coursecompleted_bulkedit.php index bfddad6..1f2ddca 100644 --- a/classes/enrol_coursecompleted_bulkedit.php +++ b/classes/enrol_coursecompleted_bulkedit.php @@ -38,7 +38,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class enrol_coursecompleted_bulkedit extends enrol_bulk_enrolment_operation { - /** * Returns the identifier for this bulk operation. This is the key used when the plugin * returns an array containing all of the bulk operations it supports. @@ -106,7 +105,7 @@ public function process(course_enrolment_manager $manager, array $users, stdClas $event->trigger(); } } - list($ueidsql, $params) = $DB->get_in_or_equal($ueids, SQL_PARAMS_NAMED); + [$ueidsql, $params] = $DB->get_in_or_equal($ueids, SQL_PARAMS_NAMED); if ($properties->status == ENROL_USER_ACTIVE || $properties->status == ENROL_USER_SUSPENDED) { $updatesql[] = 'status = :status'; $params['status'] = (int)$properties->status; diff --git a/classes/observer.php b/classes/observer.php index 645f753..329a789 100644 --- a/classes/observer.php +++ b/classes/observer.php @@ -32,7 +32,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class enrol_coursecompleted_observer { - /** * Triggered when user completes a course. * @@ -50,8 +49,13 @@ public static function enroluser(\core\event\course_completed $event) { if ($enrol->enrolperiod > 0) { $enrol->enrolenddate = max(time(), $enrol->enrolstartdate) + $enrol->enrolperiod; } - $plugin->enrol_user($enrol, $event->relateduserid, $enrol->roleid, - $enrol->enrolstartdate, $enrol->enrolenddate); + $plugin->enrol_user( + $enrol, + $event->relateduserid, + $enrol->roleid, + $enrol->enrolstartdate, + $enrol->enrolenddate + ); if ($enrol->customint2 > 0) { $adhock = new \enrol_coursecompleted\task\send_welcome(); $adhock->set_custom_data( diff --git a/classes/task/process_expirations.php b/classes/task/process_expirations.php index 4fde5e7..6c9e5d8 100644 --- a/classes/task/process_expirations.php +++ b/classes/task/process_expirations.php @@ -34,7 +34,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class process_expirations extends \core\task\scheduled_task { - /** * Name for this task. * diff --git a/classes/task/send_welcome.php b/classes/task/send_welcome.php index 795272e..27a5ee2 100644 --- a/classes/task/send_welcome.php +++ b/classes/task/send_welcome.php @@ -38,7 +38,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class send_welcome extends \core\task\adhoc_task { - /** * Execute scheduled task * @@ -57,7 +56,7 @@ public function execute() { $a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id&course=$data->courseid"; $a->completed = format_string($complcourse, true, ['context' => $context2]); $custom = $DB->get_field('enrol', 'customtext1', ['id' => $data->enrolid]); - $key = ['{$a->coursename}', '{$a->completed}', '{$a->profileurl}', '{$a->fullname}', '{$a->email}']; + $key = ['{$a->coursename}', '{$a->completed}', '{$a->profileurl}', '{$a->fullname}', '{$a->email}']; $value = [$a->coursename, $a->completed, $a->profileurl, fullname($user), $user->email]; if ($custom != '') { $message = str_replace($key, $value, $custom); @@ -68,8 +67,11 @@ public function execute() { $messagehtml = $message; } else { // This is most probably the tag/newline soup known as FORMAT_MOODLE. - $messagehtml = format_text($message, FORMAT_MOODLE, - ['context' => $context, 'para' => false, 'newlines' => true, 'filter' => true]); + $messagehtml = format_text( + $message, + FORMAT_MOODLE, + ['context' => $context, 'para' => false, 'newlines' => true, 'filter' => true] + ); } $subject = get_string('welcometocourse', 'moodle', $a->coursename); // Directly emailing welcome message rather than using messaging. diff --git a/lib.php b/lib.php index 77a9964..a3aa04a 100644 --- a/lib.php +++ b/lib.php @@ -33,7 +33,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class enrol_coursecompleted_plugin extends enrol_plugin { - /** @var bool singleinstance. */ private $singleinstance = false; @@ -138,7 +137,8 @@ public function get_user_enrolment_actions(course_enrolment_manager $manager, $u new pix_icon('a/search', ''), get_string('pluginname', 'report_completion'), new moodle_url('/report/completion/index.php', ['course' => $id]), - ['class' => 'originlink', 'rel' => $ue->id]); + ['class' => 'originlink', 'rel' => $ue->id] + ); } } return $actions; @@ -332,8 +332,12 @@ public function edit_instance_form($instance, MoodleQuickForm $mform, $context) $mform->addHelpButton('customint3', 'group', 'enrol_coursecompleted'); $mform->setDefault('customint3', $this->get_config('keepgroup')); - $mform->addElement('advcheckbox', 'customint2', get_string('categoryemail', 'admin'), - get_string('welcome', 'enrol_coursecompleted')); + $mform->addElement( + 'advcheckbox', + 'customint2', + get_string('categoryemail', 'admin'), + get_string('welcome', 'enrol_coursecompleted') + ); $mform->addHelpButton('customint2', 'welcome', 'enrol_coursecompleted'); $mform->setDefault('customint2', $this->get_config('welcome')); @@ -341,7 +345,6 @@ public function edit_instance_form($instance, MoodleQuickForm $mform, $context) $mform->addElement('textarea', 'customtext1', get_string('customwelcome', 'enrol_coursecompleted'), $arr); $mform->addHelpButton('customtext1', 'customwelcome', 'enrol_coursecompleted'); $mform->disabledIf('customtext1', 'customint2', 'notchecked'); - } /** @@ -379,9 +382,11 @@ public function edit_instance_validation($data, $files, $instance, $context) { if (!empty($data['enrolenddate']) && $data['enrolenddate'] < $data['enrolstartdate']) { $errors['enrolenddate'] = get_string('enrolenddaterror', 'enrol_paypal'); } - if (empty($data['customint1']) || + if ( + empty($data['customint1']) || $data['customint1'] == 1 || - !$DB->record_exists('course', ['id' => $data['customint1']])) { + !$DB->record_exists('course', ['id' => $data['customint1']]) + ) { $errors['customint'] = get_string('error_nonexistingcourse', 'tool_generator'); } } @@ -521,8 +526,10 @@ public static function enrol_past(int $courseid = 0) { $plugin = \enrol_get_plugin('coursecompleted'); $condition = 'course = ? AND timecompleted > 0'; foreach ($enrols as $enrol) { - if ($DB->record_exists('role', ['id' => $enrol->roleid]) && - $DB->record_exists('course', ['id' => $enrol->courseid])) { + if ( + $DB->record_exists('role', ['id' => $enrol->roleid]) && + $DB->record_exists('course', ['id' => $enrol->courseid]) + ) { if ($enrol->enrolperiod > 0) { $enrol->enrolenddate = max(time(), $enrol->enrolstartdate) + $enrol->enrolperiod; } diff --git a/manage.php b/manage.php index f4da994..ae664b3 100644 --- a/manage.php +++ b/manage.php @@ -65,11 +65,13 @@ foreach ($candidates as $candidate) { $user = \core_user::get_user($candidate); if (!empty($user) && !$user->deleted) { - $enrol->enrol_user($instance, - $candidate, - $instance->roleid, - $instance->enrolstartdate, - $instance->enrolenddate); + $enrol->enrol_user( + $instance, + $candidate, + $instance->roleid, + $instance->enrolstartdate, + $instance->enrolenddate + ); \enrol_coursecompleted_plugin::keepingroup($instance, $candidate); mark_user_dirty($candidate); echo '.'; @@ -90,8 +92,11 @@ } } $link = new \moodle_url($PAGE->url, ['enrolid' => $enrolid, 'action' => 'enrol', 'sesskey' => sesskey()]); - echo $OUTPUT->confirm(implode(', ', $allusers), new \single_button($link, get_string('manual:enrol', 'enrol_manual')), - $cancelurl); + echo $OUTPUT->confirm( + implode(', ', $allusers), + new \single_button($link, get_string('manual:enrol', 'enrol_manual')), + $cancelurl + ); } else { echo $OUTPUT->box(get_string('nousersfound')) . $br . $OUTPUT->single_button($cancelurl, get_string('cancel')); } diff --git a/settings.php b/settings.php index e2cfba9..3bc2dc6 100644 --- a/settings.php +++ b/settings.php @@ -26,15 +26,24 @@ defined('MOODLE_INTERNAL') || die(); if ($ADMIN->fulltree) { - // General settings. - $settings->add(new admin_setting_heading('enrol_coursecompleted_settings', '', - get_string('pluginname_desc', 'enrol_coursecompleted'))); + $settings->add(new admin_setting_heading( + 'enrol_coursecompleted_settings', + '', + get_string('pluginname_desc', 'enrol_coursecompleted') + )); // Enrol instance defaults. - $settings->add(new admin_setting_heading('enrol_coursecompleted_defaults', - get_string('enrolinstancedefaults', 'admin'), get_string('enrolinstancedefaults_desc', 'admin'))); - $settings->add(new admin_setting_configcheckbox('enrol_coursecompleted/defaultenrol', - get_string('defaultenrol', 'enrol'), get_string('defaultenrol_desc', 'enrol'), 0)); + $settings->add(new admin_setting_heading( + 'enrol_coursecompleted_defaults', + get_string('enrolinstancedefaults', 'admin'), + get_string('enrolinstancedefaults_desc', 'admin') + )); + $settings->add(new admin_setting_configcheckbox( + 'enrol_coursecompleted/defaultenrol', + get_string('defaultenrol', 'enrol'), + get_string('defaultenrol_desc', 'enrol'), + 0 + )); if (!during_initial_install()) { $options = [ @@ -42,30 +51,48 @@ ENROL_EXT_REMOVED_SUSPENDNOROLES => get_string('extremovedsuspendnoroles', 'enrol'), ENROL_EXT_REMOVED_UNENROL => get_string('extremovedunenrol', 'enrol'), ]; - $settings->add(new admin_setting_configselect('enrol_coursecompleted/expiredaction', - get_string('expiredaction', 'enrol_paypal'), - get_string('expiredaction_help', 'enrol_paypal'), - ENROL_EXT_REMOVED_SUSPENDNOROLES, - $options)); + $settings->add(new admin_setting_configselect( + 'enrol_coursecompleted/expiredaction', + get_string('expiredaction', 'enrol_paypal'), + get_string('expiredaction_help', 'enrol_paypal'), + ENROL_EXT_REMOVED_SUSPENDNOROLES, + $options + )); $options = get_default_enrol_roles(context_system::instance()); $student = get_archetype_roles('student'); $student = reset($student); - $settings->add(new admin_setting_configselect('enrol_coursecompleted/roleid', - get_string('defaultrole', 'enrol_coursecompleted'), - get_string('defaultrole_desc', 'enrol_coursecompleted'), - $student->id, - $options)); + $settings->add(new admin_setting_configselect( + 'enrol_coursecompleted/roleid', + get_string('defaultrole', 'enrol_coursecompleted'), + get_string('defaultrole_desc', 'enrol_coursecompleted'), + $student->id, + $options + )); } - $settings->add(new admin_setting_configduration('enrol_coursecompleted/enrolperiod', - get_string('enrolperiod', 'enrol_paypal'), - get_string('enrolperiod_desc', 'enrol_paypal'), - 0)); - $settings->add(new admin_setting_configcheckbox('enrol_coursecompleted/welcome', - get_string('welcome', 'enrol_coursecompleted'), get_string('welcome_help', 'enrol_coursecompleted'), 1)); + $settings->add(new admin_setting_configduration( + 'enrol_coursecompleted/enrolperiod', + get_string('enrolperiod', 'enrol_paypal'), + get_string('enrolperiod_desc', 'enrol_paypal'), + 0 + )); + $settings->add(new admin_setting_configcheckbox( + 'enrol_coursecompleted/welcome', + get_string('welcome', 'enrol_coursecompleted'), + get_string('welcome_help', 'enrol_coursecompleted'), + 1 + )); - $settings->add(new admin_setting_configcheckbox('enrol_coursecompleted/svglearnpath', - get_string('svglearnpath', 'enrol_coursecompleted'), get_string('svglearnpath_help', 'enrol_coursecompleted'), 1)); - $settings->add(new admin_setting_configcheckbox('enrol_coursecompleted/keepgroup', - get_string('keepgroup', 'enrol_coursecompleted'), get_string('keepgroup_help', 'enrol_coursecompleted'), 1)); + $settings->add(new admin_setting_configcheckbox( + 'enrol_coursecompleted/svglearnpath', + get_string('svglearnpath', 'enrol_coursecompleted'), + get_string('svglearnpath_help', 'enrol_coursecompleted'), + 1 + )); + $settings->add(new admin_setting_configcheckbox( + 'enrol_coursecompleted/keepgroup', + get_string('keepgroup', 'enrol_coursecompleted'), + get_string('keepgroup_help', 'enrol_coursecompleted'), + 1 + )); } diff --git a/tests/bulk_test.php b/tests/bulk_test.php index b012944..4edc479 100644 --- a/tests/bulk_test.php +++ b/tests/bulk_test.php @@ -37,7 +37,6 @@ * @coversDefaultClass \enrol_coursecompleted */ final class bulk_test extends \advanced_testcase { - /** * Setup to ensure that fixtures are loaded. */ @@ -90,7 +89,7 @@ public function test_bulkdeleted(): void { $user->enrolments = [$enr]; $this->assertfalse($operation->process($manager, [$user], new stdClass())); $this->setAdminUser(); - $this->assertTrue($operation->process($manager, [$user] , new stdClass())); + $this->assertTrue($operation->process($manager, [$user], new stdClass())); $this->assertNotEmpty($operation->get_form(null, ['users' => [$user]])); } @@ -131,11 +130,11 @@ public function test_bulkedit(): void { $properties->timeend = time() + 1000; $this->assertfalse($operation->process($manager, [$user], $properties)); $this->setAdminUser(); - $this->assertTrue($operation->process($manager, [$user] , $properties)); + $this->assertTrue($operation->process($manager, [$user], $properties)); $properties->status = 99; $properties->timestart = null; $properties->timeend = null; - $this->assertTrue($operation->process($manager, [$user] , $properties)); + $this->assertTrue($operation->process($manager, [$user], $properties)); $this->assertNotEmpty($operation->get_form(null, ['users' => [$user]])); } } diff --git a/tests/enrol_test.php b/tests/enrol_test.php index 519d07b..9b5e8ad 100644 --- a/tests/enrol_test.php +++ b/tests/enrol_test.php @@ -43,7 +43,6 @@ * @coversDefaultClass \enrol_coursecompleted_plugin */ final class enrol_test extends \advanced_testcase { - /** @var stdClass Instance. */ private $instance; @@ -86,8 +85,10 @@ protected function setUp(): void { $studentrole = $DB->get_field('role', 'id', ['shortname' => 'student']); $this->setAdminUser(); $this->plugin = enrol_get_plugin('coursecompleted'); - $id = $this->plugin->add_instance($this->course2, - ['customint1' => $this->course1->id, 'customint2' => 1, 'roleid' => $studentrole]); + $id = $this->plugin->add_instance( + $this->course2, + ['customint1' => $this->course1->id, 'customint2' => 1, 'roleid' => $studentrole] + ); $this->instance = $DB->get_record('enrol', ['id' => $id]); $this->plugin->add_instance($this->course4, ['customint1' => $this->course3->id, 'roleid' => $studentrole]); $this->plugin->add_instance($this->course3, ['customint1' => $this->course2->id, 'roleid' => $studentrole]); @@ -222,8 +223,10 @@ public function test_completion(): void { $this->assertCount(0, $manager->get_user_enrolments($this->student->id)); $ccompletion = new \completion_completion(['course' => $this->course1->id, 'userid' => $this->student->id]); $ccompletion->mark_complete(time()); - $this->assertEquals('100', - \core_completion\progress::get_course_progress_percentage($this->course1, $this->student->id)); + $this->assertEquals( + '100', + \core_completion\progress::get_course_progress_percentage($this->course1, $this->student->id) + ); $this->runAdhocTasks(); $manager = new \course_enrolment_manager($PAGE, $this->course2); $this->assertCount(1, $manager->get_user_enrolments($this->student->id)); @@ -237,8 +240,10 @@ public function test_ue(): void { global $PAGE; $ccompletion = new \completion_completion(['course' => $this->course1->id, 'userid' => $this->student->id]); $ccompletion->mark_complete(time()); - $this->assertEquals('100', - \core_completion\progress::get_course_progress_percentage($this->course1, $this->student->id)); + $this->assertEquals( + '100', + \core_completion\progress::get_course_progress_percentage($this->course1, $this->student->id) + ); $this->runAdhocTasks(); $this->setAdminUser(); $context = \context_course::instance($this->course1->id); @@ -258,7 +263,6 @@ public function test_ue(): void { $this->assertTrue($this->plugin->has_bulk_operations($manager)); $operations = $this->plugin->get_bulk_operations($manager, null); $this->assertCount(2, $operations); - } } } @@ -296,8 +300,10 @@ public function test_library(): void { $this->assertCount(1, $this->plugin->get_info_icons([$this->instance])); $this->assertCount(2, $this->plugin->get_action_icons($this->instance)); $this->assertEquals('After completing course: A1', $this->plugin->get_instance_name($this->instance)); - $this->assertEquals('Enrolment by completion of course with id ' . $this->course1->id, - $this->plugin->get_description_text($this->instance)); + $this->assertEquals( + 'Enrolment by completion of course with id ' . $this->course1->id, + $this->plugin->get_description_text($this->instance) + ); $this->assertStringContainsString('Test course 1', $this->plugin->enrol_page_hook($this->instance)); $arr = ['status' => 0, 'enrolenddate' => time(), 'enrolstartdate' => time() + 10000]; $tmp = $this->plugin->edit_instance_validation($arr, null, $this->instance, null); @@ -412,8 +418,14 @@ public function test_backup(): void { $ccompletion = new \completion_completion(['course' => $this->course1->id, 'userid' => $this->student->id]); $ccompletion->mark_complete(time()); $this->runAdhocTasks(); - $bc = new \backup_controller(\backup::TYPE_1COURSE, $this->course2->id, \backup::FORMAT_MOODLE, \backup::INTERACTIVE_NO, - \backup::MODE_GENERAL, 2); + $bc = new \backup_controller( + \backup::TYPE_1COURSE, + $this->course2->id, + \backup::FORMAT_MOODLE, + \backup::INTERACTIVE_NO, + \backup::MODE_GENERAL, + 2 + ); $bc->execute_plan(); $results = $bc->get_results(); $file = $results['backup_destination']; @@ -421,8 +433,14 @@ public function test_backup(): void { $filepath = $CFG->dataroot . '/temp/backup/test-restore-course-event'; $file->extract_to_pathname($fp, $filepath); $bc->destroy(); - $rc = new \restore_controller('test-restore-course-event', $this->course2->id, \backup::INTERACTIVE_NO, - \backup::MODE_GENERAL, 2, \backup::TARGET_NEW_COURSE); + $rc = new \restore_controller( + 'test-restore-course-event', + $this->course2->id, + \backup::INTERACTIVE_NO, + \backup::MODE_GENERAL, + 2, + \backup::TARGET_NEW_COURSE + ); $rc->execute_precheck(); $rc->execute_plan(); $newid = $rc->get_courseid(); @@ -435,8 +453,14 @@ public function test_backup(): void { $manager = new \course_enrolment_manager($PAGE, $course); $enrolments = $manager->get_user_enrolments($this->student->id); $this->assertCount(2, $enrolments); - $bc = new \backup_controller(\backup::TYPE_1COURSE, $this->course2->id, \backup::FORMAT_MOODLE, \backup::INTERACTIVE_NO, - \backup::MODE_GENERAL, 2); + $bc = new \backup_controller( + \backup::TYPE_1COURSE, + $this->course2->id, + \backup::FORMAT_MOODLE, + \backup::INTERACTIVE_NO, + \backup::MODE_GENERAL, + 2 + ); $bc->execute_plan(); $results = $bc->get_results(); $file = $results['backup_destination']; @@ -444,8 +468,14 @@ public function test_backup(): void { $filepath = $CFG->dataroot . '/temp/backup/test-restore-course-event'; $file->extract_to_pathname($fp, $filepath); $bc->destroy(); - $rc = new \restore_controller('test-restore-course-event', $newid, \backup::INTERACTIVE_NO, - \backup::MODE_GENERAL, 2, \backup::TARGET_EXISTING_ADDING); + $rc = new \restore_controller( + 'test-restore-course-event', + $newid, + \backup::INTERACTIVE_NO, + \backup::MODE_GENERAL, + 2, + \backup::TARGET_EXISTING_ADDING + ); $rc->execute_precheck(); $rc->execute_plan(); $rc->destroy(); @@ -466,8 +496,10 @@ public function test_deletedcourse(): void { $events = $sink->get_events(); $sink->close(); $this->assertEquals('Deleted course ' . $this->course1->id, $this->plugin->get_instance_name($this->instance)); - $this->assertEquals('Enrolment by completion of course with id ' . $this->course1->id, - $this->plugin->get_description_text($this->instance)); + $this->assertEquals( + 'Enrolment by completion of course with id ' . $this->course1->id, + $this->plugin->get_description_text($this->instance) + ); $event = array_pop($events); $this->assertInstanceOf('\core\event\course_deleted', $event); $observer = new \enrol_coursecompleted_observer(); diff --git a/tests/manager_test.php b/tests/manager_test.php index 4ef5dcb..7241ef6 100644 --- a/tests/manager_test.php +++ b/tests/manager_test.php @@ -35,7 +35,6 @@ * @coversDefaultClass \enrol_coursecompleted_plugin */ final class manager_test extends \advanced_testcase { - /** @var stdClass Instance. */ private $instance; diff --git a/tests/other_test.php b/tests/other_test.php index 7e0c73c..903856e 100644 --- a/tests/other_test.php +++ b/tests/other_test.php @@ -42,7 +42,6 @@ * @coversDefaultClass \enrol_coursecompleted_plugin */ final class other_test extends \advanced_testcase { - /** * Tests initial setup. */ @@ -97,7 +96,7 @@ public function test_invalid_instance(): void { */ public function test_static_past(): void { global $CFG, $DB; - require_once($CFG->libdir.'/completionlib.php'); + require_once($CFG->libdir . '/completionlib.php'); $generator = $this->getDataGenerator(); $plugin = enrol_get_plugin('coursecompleted'); $manualplugin = enrol_get_plugin('manual'); @@ -205,7 +204,7 @@ public function test_groups_child(): void { * @covers \enrol_coursecompleted\task\process_expirations */ public function test_task(): void { - $task = new \enrol_coursecompleted\task\process_expirations; + $task = new \enrol_coursecompleted\task\process_expirations(); $this->assertEquals('Course completed enrolment expiry task', $task->get_name()); ob_start(); $task->execute(); @@ -232,8 +231,10 @@ public function test_adhoc_email_welcome_message(): void { $plugin->add_instance($course, ['customint1' => $courseid1, 'roleid' => 5, 'customint2' => 0]); $i2 = $plugin->add_instance($course, ['customint1' => $courseid2, 'roleid' => 5, 'customint2' => 1]); $i3 = $plugin->add_instance($course, ['customint1' => $courseid3, 'customtext1' => 'boe', 'customint2' => 1]); - $i4 = $plugin->add_instance($course, - ['customint1' => $courseid4, 'customtext1' => '{$a->fullname} boe', 'customint2' => 1]); + $i4 = $plugin->add_instance( + $course, + ['customint1' => $courseid4, 'customtext1' => '{$a->fullname} boe', 'customint2' => 1] + ); $compevent = \core\event\course_completed::create( [ 'objectid' => $courseid1, @@ -247,15 +248,18 @@ public function test_adhoc_email_welcome_message(): void { $observer->enroluser($compevent); $adhock = new \enrol_coursecompleted\task\send_welcome(); $adhock->set_custom_data( - ['userid' => $studentid, 'enrolid' => $i2, 'courseid' => $course->id, 'completedid' => $courseid2]); + ['userid' => $studentid, 'enrolid' => $i2, 'courseid' => $course->id, 'completedid' => $courseid2] + ); $adhock->set_component('enrol_coursecompleted'); $adhock->execute(); \core\task\manager::queue_adhoc_task($adhock); $adhock->set_custom_data( - ['userid' => $studentid, 'enrolid' => $i3, 'courseid' => $course->id, 'completedid' => $courseid3]); + ['userid' => $studentid, 'enrolid' => $i3, 'courseid' => $course->id, 'completedid' => $courseid3] + ); \core\task\manager::queue_adhoc_task($adhock); $adhock->set_custom_data( - ['userid' => $studentid, 'enrolid' => $i4, 'courseid' => $course->id, 'completedid' => $courseid4]); + ['userid' => $studentid, 'enrolid' => $i4, 'courseid' => $course->id, 'completedid' => $courseid4] + ); \core\task\manager::queue_adhoc_task($adhock); $this->assertCount(3, $DB->get_records('task_adhoc', ['component' => 'enrol_coursecompleted'])); \phpunit_util::run_all_adhoc_tasks(); diff --git a/tests/privacy/privacy_test.php b/tests/privacy/privacy_test.php index 85199e1..bc26f59 100644 --- a/tests/privacy/privacy_test.php +++ b/tests/privacy/privacy_test.php @@ -36,7 +36,6 @@ * @coversDefaultClass \enrol_coursecompleted\privacy\provider */ final class privacy_test extends provider_testcase { - /** * Test returning metadata. * @covers \enrol_coursecompleted\privacy\provider