From 334f6199649e5915e1e9c806df1cc209f04c6023 Mon Sep 17 00:00:00 2001 From: TamaroWalter Date: Tue, 28 May 2024 15:29:41 +0200 Subject: [PATCH] codecleaning --- classes/task/send_daily_mail.php | 4 ++-- tests/dailymail_test.php | 4 ++-- tests/review_test.php | 16 ++++++++-------- tests/subscriptions_test.php | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/classes/task/send_daily_mail.php b/classes/task/send_daily_mail.php index 75f110ab3a..a4494bea74 100644 --- a/classes/task/send_daily_mail.php +++ b/classes/task/send_daily_mail.php @@ -56,13 +56,13 @@ public function execute() { $mail = []; // Fill the $mail array. foreach ($userdata as $row) { - $currentcourse = $DB->get_record('course', array('id' => $row->courseid), 'fullname, id'); + $currentcourse = $DB->get_record('course', ['id' => $row->courseid], 'fullname, id'); // Check if the user is enrolled in the course, if not, go to the next row. if (!is_enrolled(\context_course::instance($row->courseid), $user->userid, '', true)) { continue; } - $currentforum = $DB->get_record('moodleoverflow', array('id' => $row->forumid), 'name, id'); + $currentforum = $DB->get_record('moodleoverflow', ['id' => $row->forumid], 'name, id'); $coursemoduleid = get_coursemodule_from_instance('moodleoverflow', $row->forumid); $discussion = $DB->get_record('moodleoverflow_discussions', ['id' => $row->forumdiscussionid], 'name, id'); $unreadposts = $row->numberofposts; diff --git a/tests/dailymail_test.php b/tests/dailymail_test.php index c6e45123e1..3badfa178a 100644 --- a/tests/dailymail_test.php +++ b/tests/dailymail_test.php @@ -98,7 +98,7 @@ public function tearDown(): void { public function helper_create_user_and_discussion($maildigest) { // Create a user enrolled in the course as student. $this->user = $this->getDataGenerator()->create_user(['firstname' => 'Tamaro', 'email' => 'tamaromail@example.com', - 'maildigest' => $maildigest]); + 'maildigest' => $maildigest, ]); $this->getDataGenerator()->enrol_user($this->user->id, $this->course->id, 'student'); // Create a new discussion and post within the moodleoverflow. @@ -165,7 +165,7 @@ public function test_delivery_not_enrolled(): void { $location = ['course' => $course->id, 'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE]; $moodleoverflow = $this->getDataGenerator()->create_module('moodleoverflow', $location); $student = $this->getDataGenerator()->create_user(['firstname' => 'Ethan', 'email' => 'ethanmail@example.com', - 'maildigest' => '1']); + 'maildigest' => '1', ]); $this->getDataGenerator()->enrol_user($student->id, $course->id, 'teacher'); $discussion = $this->generator->post_to_forum($moodleoverflow, $student); diff --git a/tests/review_test.php b/tests/review_test.php index d9478552bc..43d91d57a1 100644 --- a/tests/review_test.php +++ b/tests/review_test.php @@ -307,23 +307,23 @@ private function check_mail_records($teacherpost, $studentpost, $review1, $revie global $DB; // Fetch the posts directly after creation - $teacherpostDB = $DB->get_record('moodleoverflow_posts', ['id' => $teacherpost->id]); - $studentpostDB = $DB->get_record('moodleoverflow_posts', ['id' => $studentpost->id]); + $teacherpostdb = $DB->get_record('moodleoverflow_posts', ['id' => $teacherpost->id]); + $studentpostdb = $DB->get_record('moodleoverflow_posts', ['id' => $studentpost->id]); // Assert initial state - $this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_PENDING, 'reviewed' => $review1, 'timereviewed' => null], $teacherpostDB); - $this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_PENDING, 'reviewed' => $review2, 'timereviewed' => null], $studentpostDB); + $this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_PENDING, 'reviewed' => $review1, 'timereviewed' => null], $teacherpostdb); + $this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_PENDING, 'reviewed' => $review2, 'timereviewed' => null], $studentpostdb); $this->run_send_mails(); $this->run_send_mails(); // Execute twice to ensure no duplicate mails. // Fetch the posts after mailing - $teacherpostDB = $DB->get_record('moodleoverflow_posts', ['id' => $teacherpost->id]); - $studentpostDB = $DB->get_record('moodleoverflow_posts', ['id' => $studentpost->id]); + $teacherpostdb = $DB->get_record('moodleoverflow_posts', ['id' => $teacherpost->id]); + $studentpostdb = $DB->get_record('moodleoverflow_posts', ['id' => $studentpost->id]); // Assert post-mail state - $this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_SUCCESS, 'reviewed' => $review1, 'timereviewed' => null], $teacherpostDB); - $this->assert_matches_properties(['mailed' => $mailed, 'reviewed' => $review2, 'timereviewed' => null], $studentpostDB); + $this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_SUCCESS, 'reviewed' => $review1, 'timereviewed' => null], $teacherpostdb); + $this->assert_matches_properties(['mailed' => $mailed, 'reviewed' => $review2, 'timereviewed' => null], $studentpostdb); } } diff --git a/tests/subscriptions_test.php b/tests/subscriptions_test.php index 756a67eae5..2de58cf8b2 100644 --- a/tests/subscriptions_test.php +++ b/tests/subscriptions_test.php @@ -1382,7 +1382,7 @@ public function is_subscribable_moodleoverflows() { * * @return array */ - public function is_subscribable_provider() { + public function is_subscribable_provider(): array { $data = []; foreach ($this->is_subscribable_moodleoverflows() as $moodleoverflow) { $data[] = [$moodleoverflow]; @@ -1440,7 +1440,7 @@ public function test_is_subscribable_is_guest($options): void { * Returns subscription obtions. * @return array */ - public function is_subscribable_loggedin_provider() { + public function is_subscribable_loggedin_provider(): array { return [ [ ['forcesubscribe' => MOODLEOVERFLOW_DISALLOWSUBSCRIBE],