From afa5c9e5572d2b10b64a02f016fbdfeed9f2262c Mon Sep 17 00:00:00 2001
From: TamaroWalter
Date: Wed, 13 Mar 2024 16:14:37 +0100
Subject: [PATCH 1/2] fix in backup function
---
.../backup_moodleoverflow_stepslib.php | 19 ++++----
classes/manager/mail_manager.php | 2 +-
classes/observer.php | 2 +-
classes/privacy/provider.php | 10 ++---
classes/ratings.php | 2 +-
classes/subscriptions.php | 4 +-
classes/tables/userstats_table.php | 6 +--
classes/task/send_daily_mail.php | 2 +-
discussion.php | 4 +-
lib.php | 2 +-
locallib.php | 6 +--
mod_form.php | 4 +-
post.php | 4 +-
tests/behat/behat_mod_moodleoverflow.php | 2 +-
tests/dailymail_test.php | 8 ++--
tests/locallib_test.php | 8 ++--
tests/post_test.php | 4 +-
tests/privacy_provider_test.php | 36 +++++++--------
tests/ratings_test.php | 8 ++--
tests/readtracking_test.php | 4 +-
tests/review_test.php | 12 ++---
tests/subscriptions_test.php | 44 +++++++++----------
tests/userstats_test.php | 14 +++---
userstats.php | 2 +-
24 files changed, 104 insertions(+), 105 deletions(-)
diff --git a/backup/moodle2/backup_moodleoverflow_stepslib.php b/backup/moodle2/backup_moodleoverflow_stepslib.php
index 91c7499684..34c7d7d735 100644
--- a/backup/moodle2/backup_moodleoverflow_stepslib.php
+++ b/backup/moodle2/backup_moodleoverflow_stepslib.php
@@ -45,25 +45,26 @@ protected function define_structure() {
// Define the root element describing the moodleoverflow instance.
$moodleoverflow = new backup_nested_element('moodleoverflow', ['id'], [
- 'name', 'intro', 'introformat', 'maxbytes', 'maxattachments',
- 'forcesubscribe', 'trackingtype', 'timecreated', 'timemodified',
- 'ratingpreference', 'coursewidereputation', 'allownegativereputation']);
+ 'name', 'intro', 'introformat', 'maxbytes', 'maxattachments', 'timecreated', 'timemodified',
+ 'forcesubscribe', 'trackingtype', 'ratingpreference', 'coursewidereputation', 'allowrating',
+ 'allowreputation', 'allownegativereputation', 'grademaxgrade', 'gradescalefactor', 'gradecat',
+ 'anonymous', 'needsreview', 'allowmultiplemarks', ]);
// Define each element separated.
$discussions = new backup_nested_element('discussions');
$discussion = new backup_nested_element('discussion', ['id'], [
- 'name', 'firstpost', 'userid', 'timemodified', 'usermodified', 'timestart']);
+ 'name', 'firstpost', 'userid', 'timemodified', 'usermodified', 'timestart', ]);
$posts = new backup_nested_element('posts');
$post = new backup_nested_element('post', ['id'], [
'parent', 'userid', 'created', 'modified',
- 'mailed', 'message', 'messageformat', 'attachment']);
+ 'mailed', 'message', 'messageformat', 'attachment', ]);
$ratings = new backup_nested_element('ratings');
$rating = new backup_nested_element('rating', ['id'], [
- 'userid', 'rating', 'firstrated', 'lastchanged']);
+ 'userid', 'rating', 'firstrated', 'lastchanged', ]);
$discussionsubs = new backup_nested_element('discuss_subs');
@@ -75,18 +76,18 @@ protected function define_structure() {
$subscriptions = new backup_nested_element('subscriptions');
$subscription = new backup_nested_element('subscription', ['id'], [
- 'userid']);
+ 'userid', ]);
$readposts = new backup_nested_element('readposts');
$read = new backup_nested_element('read', ['id'], [
'userid', 'discussionid', 'postid', 'firstread',
- 'lastread']);
+ 'lastread', ]);
$tracking = new backup_nested_element('tracking');
$track = new backup_nested_element('track', ['id'], [
- 'userid']);
+ 'userid', ]);
// Build the tree.
$moodleoverflow->add_child($discussions);
diff --git a/classes/manager/mail_manager.php b/classes/manager/mail_manager.php
index 81d7a94142..fd1e8385e0 100644
--- a/classes/manager/mail_manager.php
+++ b/classes/manager/mail_manager.php
@@ -406,7 +406,7 @@ private static function send_post($userto, $post, array &$coursemodules, array &
['userid' => $dataobject->userid,
'courseid' => $dataobject->courseid,
'forumid' => $dataobject->forumid,
- 'forumdiscussionid' => $dataobject->forumdiscussionid],
+ 'forumdiscussionid' => $dataobject->forumdiscussionid, ],
'numberofposts, id');
if (is_object($record)) {
$dataset = $record;
diff --git a/classes/observer.php b/classes/observer.php
index 78dce0f41a..8dc215b203 100644
--- a/classes/observer.php
+++ b/classes/observer.php
@@ -95,7 +95,7 @@ public static function role_assigned(\core\event\role_assigned $event) {
WHERE m.course = :courseid AND m.forcesubscribe = :initial AND mo.name = 'moodleoverflow' AND ms.id IS NULL";
$params = ['courseid' => $context->instanceid,
'userid' => $userid,
- 'initial' => MOODLEOVERFLOW_INITIALSUBSCRIBE];
+ 'initial' => MOODLEOVERFLOW_INITIALSUBSCRIBE, ];
$moodleoverflows = $DB->get_records_sql($sql, $params);
// Loop through all moodleoverflows.
diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php
index d29f6b22e8..d1bf9e7644 100644
--- a/classes/privacy/provider.php
+++ b/classes/privacy/provider.php
@@ -324,22 +324,22 @@ public static function delete_data_for_user(approved_contextlist $contextlist) {
$DB->delete_records('moodleoverflow_read', [
'moodleoverflowid' => $forum->id,
- 'userid' => $userid]);
+ 'userid' => $userid, ]);
$DB->delete_records('moodleoverflow_subscriptions', [
'moodleoverflow' => $forum->id,
- 'userid' => $userid]);
+ 'userid' => $userid, ]);
$DB->delete_records('moodleoverflow_discuss_subs', [
'moodleoverflow' => $forum->id,
- 'userid' => $userid]);
+ 'userid' => $userid, ]);
$DB->delete_records('moodleoverflow_tracking', [
'moodleoverflowid' => $forum->id,
- 'userid' => $userid]);
+ 'userid' => $userid, ]);
$DB->delete_records('moodleoverflow_grades', [
'moodleoverflowid' => $forum->id,
- 'userid' => $userid]);
+ 'userid' => $userid, ]);
// Do not delete ratings but reset userid.
$ratingsql = "userid = :userid AND discussionid IN
diff --git a/classes/ratings.php b/classes/ratings.php
index e19568613a..8756545d21 100644
--- a/classes/ratings.php
+++ b/classes/ratings.php
@@ -57,7 +57,7 @@ public static function moodleoverflow_add_rating($moodleoverflow, $postid, $rati
// Is the submitted rating valid?
$possibleratings = [RATING_NEUTRAL, RATING_DOWNVOTE, RATING_UPVOTE, RATING_SOLVED,
RATING_HELPFUL, RATING_REMOVE_DOWNVOTE, RATING_REMOVE_UPVOTE,
- RATING_REMOVE_SOLVED, RATING_REMOVE_HELPFUL];
+ RATING_REMOVE_SOLVED, RATING_REMOVE_HELPFUL, ];
if (!in_array($rating, $possibleratings)) {
throw new moodle_exception('invalidratingid', 'moodleoverflow');
}
diff --git a/classes/subscriptions.php b/classes/subscriptions.php
index 23464b306f..83af4181d2 100644
--- a/classes/subscriptions.php
+++ b/classes/subscriptions.php
@@ -438,7 +438,7 @@ public static function get_unsubscribable_moodleoverflows() {
WHERE m.forcesubscribe <> :forcesubscribe AND ms.id IS NOT NULL AND cm.course $coursesql";
$params = ['modulename' => 'moodleoverflow',
'userid' => $USER->id,
- 'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE];
+ 'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE, ];
$mergedparams = array_merge($courseparams, $params);
$moodleoverflows = $DB->get_recordset_sql($sql, $mergedparams);
@@ -670,7 +670,7 @@ public static function subscribe_user($userid, $moodleoverflow, $context, $userr
$params = [
'userid' => $userid,
'moodleoverflowid' => $moodleoverflow->id,
- 'preference' => self::MOODLEOVERFLOW_DISCUSSION_UNSUBSCRIBED];
+ 'preference' => self::MOODLEOVERFLOW_DISCUSSION_UNSUBSCRIBED, ];
$where = 'userid = :userid AND moodleoverflow = :moodleoverflowid AND preference <> :preference';
$DB->delete_records_select('moodleoverflow_discuss_subs', $where, $params);
diff --git a/classes/tables/userstats_table.php b/classes/tables/userstats_table.php
index 94458c5ba0..dfb176fd06 100644
--- a/classes/tables/userstats_table.php
+++ b/classes/tables/userstats_table.php
@@ -75,7 +75,7 @@ public function __construct($uniqueid, $courseid, $moodleoverflow, $url) {
'forumactivity',
'courseactivity',
'forumreputation',
- 'coursereputation']);
+ 'coursereputation', ]);
$this->define_baseurl($url);
$this->define_headers([get_string('fullnameuser'),
get_string('userstatsupvotes', 'moodleoverflow'),
@@ -83,7 +83,7 @@ public function __construct($uniqueid, $courseid, $moodleoverflow, $url) {
(get_string('userstatsforumactivity', 'moodleoverflow') . $this->helpactivity->object),
(get_string('userstatscourseactivity', 'moodleoverflow') . $this->helpactivity->object),
get_string('userstatsforumreputation', 'moodleoverflow'),
- get_string('userstatscoursereputation', 'moodleoverflow')]);
+ get_string('userstatscoursereputation', 'moodleoverflow'), ]);
$this->get_table_data();
$this->sortable(true, 'coursereputation', SORT_DESC);
$this->no_sorting('username');
@@ -277,7 +277,7 @@ public function set_helpactivity() {
'tabindex' => '0',
'data-content' => '' .
get_string('helpamountofactivity', 'moodleoverflow') .
- '
'];
+ '
', ];
$this->helpactivity->object = \html_writer::span($this->helpactivity->icon,
$this->helpactivity->class,
diff --git a/classes/task/send_daily_mail.php b/classes/task/send_daily_mail.php
index 2370b8cf83..48ac7a67b2 100644
--- a/classes/task/send_daily_mail.php
+++ b/classes/task/send_daily_mail.php
@@ -76,7 +76,7 @@ public function execute() {
$string = get_string('digestunreadpost', 'mod_moodleoverflow', ['linktocourse' => $linktocourse,
'linktoforum' => $linktoforum,
'linktodiscussion' => $linktodiscussion,
- 'unreadposts' => $unreadposts]);
+ 'unreadposts' => $unreadposts, ]);
array_push($mail, $string);
}
// Build the final message and send it to user. Then remove the sent records.
diff --git a/discussion.php b/discussion.php
index 3b9b429cc7..262666d327 100644
--- a/discussion.php
+++ b/discussion.php
@@ -161,9 +161,7 @@
echo '';
-//moodleoverflow_print_discussion($course, $cm, $moodleoverflow, $discussion, $post, $multiplemarks);
-$processingdata = get_moduleinfo_data($cm, $course);
-var_dump($processingdata);
+moodleoverflow_print_discussion($course, $cm, $moodleoverflow, $discussion, $post, $multiplemarks);
echo '
';
echo $OUTPUT->footer();
diff --git a/lib.php b/lib.php
index 672872ad9f..e62d19c861 100644
--- a/lib.php
+++ b/lib.php
@@ -787,7 +787,7 @@ function moodleoverflow_send_mails() {
['userid' => $dataobject->userid,
'courseid' => $dataobject->courseid,
'forumid' => $dataobject->forumid,
- 'forumdiscussionid' => $dataobject->forumdiscussionid],
+ 'forumdiscussionid' => $dataobject->forumdiscussionid, ],
'numberofposts, id');
if (is_object($record)) {
$dataset = $record;
diff --git a/locallib.php b/locallib.php
index 917889e8cf..10632384a6 100644
--- a/locallib.php
+++ b/locallib.php
@@ -157,7 +157,7 @@ function moodleoverflow_print_latest_discussions($moodleoverflow, $cm, $page = -
$userstatsbuttontext = get_string('seeuserstats', 'moodleoverflow');
$userstatsbuttonurl = new moodle_url('/mod/moodleoverflow/userstats.php', ['id' => $cm->id,
'courseid' => $moodleoverflow->course,
- 'mid' => $moodleoverflow->id]);
+ 'mid' => $moodleoverflow->id, ]);
$userstatsbutton = new single_button($userstatsbuttonurl, $userstatsbuttontext, 'get');
$userstatsbutton->class = 'singlebutton align-middle m-2';
echo $OUTPUT->render($userstatsbutton);
@@ -325,7 +325,7 @@ function moodleoverflow_print_latest_discussions($moodleoverflow, $cm, $page = -
} else {
// Get his picture, his name and the link to his profile.
$preparedarray[$i]['picture'] = $OUTPUT->user_picture($startuser, ['courseid' => $moodleoverflow->course,
- 'link' => false]);
+ 'link' => false, ]);
$preparedarray[$i]['username'] = fullname($startuser, has_capability('moodle/site:viewfullnames', $context));
$preparedarray[$i]['userlink'] = $CFG->wwwroot . '/user/view.php?id=' .
$discussion->userid . '&course=' . $moodleoverflow->course;
@@ -2061,7 +2061,7 @@ function moodleoverflow_update_user_grade_on_db($moodleoverflow, $postuserrating
if ($DB->record_exists('moodleoverflow_grades', ['userid' => $userid, 'moodleoverflowid' => $moodleoverflow->id])) {
$DB->set_field('moodleoverflow_grades', 'grade', $grade, ['userid' => $userid,
- 'moodleoverflowid' => $moodleoverflow->id]);
+ 'moodleoverflowid' => $moodleoverflow->id, ]);
} else {
diff --git a/mod_form.php b/mod_form.php
index 6a2509f3bd..a605ca3468 100644
--- a/mod_form.php
+++ b/mod_form.php
@@ -271,8 +271,8 @@ public function data_postprocessing($data) {
* @param $default_values
* @return void
*/
- public function data_preprocessing(&$default_values) {
- parent::data_preprocessing($default_values);
+ public function data_preprocessing(&$defaultvalues) {
+ parent::data_preprocessing($defaultvalues);
// Fill the anonymous and the grade options with the values that were set.
diff --git a/post.php b/post.php
index fe228c6563..976c8f538c 100644
--- a/post.php
+++ b/post.php
@@ -653,7 +653,7 @@
'other' => [
'discussionid' => $discussion->id,
'moodleoverflowid' => $moodleoverflow->id,
- ]];
+ ], ];
// If the editing user is not the original author, add the original author to the params.
if ($realpost->userid != $USER->id) {
@@ -705,7 +705,7 @@
'other' => [
'discussionid' => $discussion->id,
'moodleoverflowid' => $moodleoverflow->id,
- ]];
+ ], ];
$event = \mod_moodleoverflow\event\post_created::create($params);
$event->trigger();
redirect(
diff --git a/tests/behat/behat_mod_moodleoverflow.php b/tests/behat/behat_mod_moodleoverflow.php
index 709dae2ef6..4569c1c2ca 100644
--- a/tests/behat/behat_mod_moodleoverflow.php
+++ b/tests/behat/behat_mod_moodleoverflow.php
@@ -103,7 +103,7 @@ protected function add_new_discussion($moodleoverflowname, TableNode $table, $bu
// Navigate to moodleoverflow.
$this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($moodleoverflowname),
- 'moodleoverflow activity']);
+ 'moodleoverflow activity', ]);
$this->execute('behat_forms::press_button', $buttonstr);
// Fill form and post.
diff --git a/tests/dailymail_test.php b/tests/dailymail_test.php
index 922050e033..cc2e122a7e 100644
--- a/tests/dailymail_test.php
+++ b/tests/dailymail_test.php
@@ -136,7 +136,7 @@ private function helper_run_send_mails() {
* Test if the task send_daily_mail sends a mail to the user.
* @covers \send_daily_mail::execute
*/
- public function test_mail_delivery() {
+ public function test_mail_delivery(): void {
// Create user with maildigest = on.
$this->helper_create_user_and_discussion('1');
@@ -154,7 +154,7 @@ public function test_mail_delivery() {
* Test if the content of the mail matches the supposed content.
* @covers \send_daily_mail::execute
*/
- public function test_content_of_mail_delivery() {
+ public function test_content_of_mail_delivery(): void {
// Create user with maildigest = on.
$this->helper_create_user_and_discussion('1');
@@ -189,7 +189,7 @@ public function test_content_of_mail_delivery() {
* Test if the task does not send a mail when maildigest = 0
* @covers \send_daily_mail::execute
*/
- public function test_mail_not_send() {
+ public function test_mail_not_send(): void {
// Creat user with daily_mail = off.
$this->helper_create_user_and_discussion('0');
@@ -205,7 +205,7 @@ public function test_mail_not_send() {
* Test if database is updated after sending a mail
* @covers \send_daily_mail::execute
*/
- public function test_records_removed() {
+ public function test_records_removed(): void {
global $DB;
// Create user with maildigest = on.
$this->helper_create_user_and_discussion('1');
diff --git a/tests/locallib_test.php b/tests/locallib_test.php
index cc3fb54265..9207c21bf3 100644
--- a/tests/locallib_test.php
+++ b/tests/locallib_test.php
@@ -50,7 +50,7 @@ public function tearDown(): void {
* Test subscription using automatic subscription on create.
* @covers \mod_moodleoverflow\subscriptions Subscription of users as default.
*/
- public function test_moodleoverflow_auto_subscribe_on_create() {
+ public function test_moodleoverflow_auto_subscribe_on_create(): void {
global $DB;
$this->resetAfterTest();
@@ -83,7 +83,7 @@ public function test_moodleoverflow_auto_subscribe_on_create() {
* Test subscription using forced subscription on create.
* @covers \mod_moodleoverflow\subscriptions sorced Subscription of users.
*/
- public function test_moodleoverflow_forced_subscribe_on_create() {
+ public function test_moodleoverflow_forced_subscribe_on_create(): void {
global $DB;
$this->resetAfterTest();
@@ -115,7 +115,7 @@ public function test_moodleoverflow_forced_subscribe_on_create() {
* Test subscription using optional subscription on create.
* @covers \mod_moodleoverflow\subscriptions optional subscription.
*/
- public function test_moodleoverflow_optional_subscribe_on_create() {
+ public function test_moodleoverflow_optional_subscribe_on_create(): void {
global $DB;
$this->resetAfterTest();
@@ -146,7 +146,7 @@ public function test_moodleoverflow_optional_subscribe_on_create() {
* Test subscription using disallow subscription on create.
* @covers \mod_moodleoverflow\subscriptions prohibit Subscription of users.
*/
- public function test_moodleoverflow_disallow_subscribe_on_create() {
+ public function test_moodleoverflow_disallow_subscribe_on_create(): void {
global $DB;
$this->resetAfterTest();
diff --git a/tests/post_test.php b/tests/post_test.php
index 6e7d6394d9..b29614c879 100644
--- a/tests/post_test.php
+++ b/tests/post_test.php
@@ -75,7 +75,7 @@ public function tearDown(): void {
* Test if a post and its attachment are deleted successfully.
* @covers ::moodleoverflow_delete_post
*/
- public function test_moodleoverflow_delete_post() {
+ public function test_moodleoverflow_delete_post(): void {
global $DB;
// The attachment should exist.
@@ -95,7 +95,7 @@ public function test_moodleoverflow_delete_post() {
* Test if a post and its attachment are deleted successfully.
* @covers ::moodleoverflow_delete_discussion
*/
- public function test_moodleoverflow_delete_discussion() {
+ public function test_moodleoverflow_delete_discussion(): void {
global $DB;
$numberofattachments = count($DB->get_records('files', ['itemid' => $this->post->id, 'filearea' => 'attachment']));
diff --git a/tests/privacy_provider_test.php b/tests/privacy_provider_test.php
index 4e083dd469..5b6d7b60a3 100644
--- a/tests/privacy_provider_test.php
+++ b/tests/privacy_provider_test.php
@@ -119,7 +119,7 @@ protected function assert_post_data($expected, $actual, $writer) {
* @return void
* @throws \coding_exception
*/
- public function test_user_has_never_posted() {
+ public function test_user_has_never_posted(): void {
// Create a course with moodleoverflow forums.
list($course, $forum) = $this->create_courses_and_modules(3);
// Create users.
@@ -150,7 +150,7 @@ public function test_user_has_never_posted() {
* posted and has subscribed to the forum will have relevant
* information returned.
*/
- public function test_user_has_never_posted_subscribed_to_forum() {
+ public function test_user_has_never_posted_subscribed_to_forum(): void {
// Create a course, with a forum, our user under test, another user, and a discussion + post from the other user.
list($course, $forum) = $this->create_courses_and_modules(3);
list($user, $otheruser) = $this->create_and_enrol_users($course, 2);
@@ -183,7 +183,7 @@ public function test_user_has_never_posted_subscribed_to_forum() {
* posted and has subscribed to the discussion will have relevant
* information returned.
*/
- public function test_user_has_never_posted_subscribed_to_discussion() {
+ public function test_user_has_never_posted_subscribed_to_discussion(): void {
// Create a course, with a forum, our user under test, another user, and a discussion + post from the other user.
list($course, $forum) = $this->create_courses_and_modules(3);
// Create users.
@@ -228,7 +228,7 @@ public function test_user_has_never_posted_subscribed_to_discussion() {
* Test that a user who has posted their own discussion will have all
* content returned.
*/
- public function test_user_has_posted_own_discussion() {
+ public function test_user_has_posted_own_discussion(): void {
list($course, $forum) = $this->create_courses_and_modules(3);
list($user, $otheruser) = $this->create_users($course, 2);
// Post twice - only the second discussion should be included.
@@ -256,7 +256,7 @@ public function test_user_has_posted_own_discussion() {
* Test that a user who has posted a reply to another users discussion
* will have all content returned.
*/
- public function test_user_has_posted_reply() {
+ public function test_user_has_posted_reply(): void {
global $DB;
// Create several courses and forums. We only insert data into the final one.
list($course, $forum) = $this->create_courses_and_modules(3);
@@ -296,7 +296,7 @@ public function test_user_has_posted_reply() {
* Test that the rating of another users content will have only the
* rater's information returned.
*/
- public function test_user_has_rated_others() {
+ public function test_user_has_rated_others(): void {
$course = $this->getDataGenerator()->create_course();
$forum = $this->getDataGenerator()->create_module('moodleoverflow', [
'course' => $course->id,
@@ -339,7 +339,7 @@ public function test_user_has_rated_others() {
/**
* Test that ratings of a users own content will all be returned.
*/
- public function test_user_has_been_rated() {
+ public function test_user_has_been_rated(): void {
$course = $this->getDataGenerator()->create_course();
$forum = $this->getDataGenerator()->create_module('moodleoverflow', [
'course' => $course->id,
@@ -377,7 +377,7 @@ public function test_user_has_been_rated() {
/**
* Test that the per-user, per-forum user tracking data is exported.
*/
- public function test_user_tracking_data() {
+ public function test_user_tracking_data(): void {
$course = $this->getDataGenerator()->create_course();
$forumoff = $this->getDataGenerator()->create_module('moodleoverflow', ['course' => $course->id]);
$cmoff = get_coursemodule_from_instance('moodleoverflow', $forumoff->id);
@@ -403,7 +403,7 @@ public function test_user_tracking_data() {
/**
* Test that the posts which a user has read are returned correctly.
*/
- public function test_user_read_posts() {
+ public function test_user_read_posts(): void {
global $DB;
$course = $this->getDataGenerator()->create_course();
$forum1 = $this->getDataGenerator()->create_module('moodleoverflow', ['course' => $course->id]);
@@ -534,7 +534,7 @@ public function test_user_read_posts() {
/**
* Test that posts with attachments have their attachments correctly exported.
*/
- public function test_post_attachment_inclusion() {
+ public function test_post_attachment_inclusion(): void {
global $DB;
$fs = get_file_storage();
$course = $this->getDataGenerator()->create_course();
@@ -1132,7 +1132,7 @@ public function test_delete_data_for_users() {
/**
* Ensure that the discussion author is listed as a user in the context.
*/
- public function test_get_users_in_context_post_author() {
+ public function test_get_users_in_context_post_author(): void {
global $DB;
$component = 'mod_moodleoverflow';
@@ -1157,7 +1157,7 @@ public function test_get_users_in_context_post_author() {
/**
* Ensure that all post authors are included as a user in the context.
*/
- public function test_get_users_in_context_post_authors() {
+ public function test_get_users_in_context_post_authors(): void {
global $DB;
$component = 'mod_moodleoverflow';
@@ -1192,7 +1192,7 @@ public function test_get_users_in_context_post_authors() {
* Ensure that all post raters are included as a user in the context --> this is different from the forum ratings,
* since ratings in moodle overflow are saved in a separate table
*/
- public function test_get_users_in_context_post_ratings() {
+ public function test_get_users_in_context_post_ratings(): void {
global $DB;
$component = 'mod_moodleoverflow';
@@ -1234,7 +1234,7 @@ public function test_get_users_in_context_post_ratings() {
/**
* Ensure that all users with a moodleoverflow subscription preference included as a user in the context.
*/
- public function test_get_users_in_context_with_subscription() {
+ public function test_get_users_in_context_with_subscription(): void {
global $DB;
$component = 'mod_moodleoverflow';
@@ -1271,7 +1271,7 @@ public function test_get_users_in_context_with_subscription() {
/**
* Ensure that all users with a per-discussion subscription preference included as a user in the context.
*/
- public function test_get_users_in_context_with_discussion_subscription() {
+ public function test_get_users_in_context_with_discussion_subscription(): void {
$component = 'mod_moodleoverflow';
$course = $this->getDataGenerator()->create_course();
@@ -1310,7 +1310,7 @@ public function test_get_users_in_context_with_discussion_subscription() {
/**
* Ensure that all users with read tracking are included as a user in the context.
*/
- public function test_get_users_in_context_with_read_post_tracking() {
+ public function test_get_users_in_context_with_read_post_tracking(): void {
$component = 'mod_moodleoverflow';
$course = $this->getDataGenerator()->create_course();
@@ -1366,7 +1366,7 @@ public function test_get_users_in_context_with_read_post_tracking() {
/**
* Ensure that all users with tracking preferences are included as a user in the context.
*/
- public function test_get_users_in_context_with_tracking_preferences() {
+ public function test_get_users_in_context_with_tracking_preferences(): void {
global $DB;
$component = 'mod_moodleoverflow';
@@ -1421,7 +1421,7 @@ public function test_get_users_in_context_with_tracking_preferences() {
* @throws coding_exception
* @throws dml_exception
*/
- public function test_grades() {
+ public function test_grades(): void {
global $DB;
$course = self::getDataGenerator()->create_course();
diff --git a/tests/ratings_test.php b/tests/ratings_test.php
index daa2a7aff2..f0dccc267b 100644
--- a/tests/ratings_test.php
+++ b/tests/ratings_test.php
@@ -107,7 +107,7 @@ public function tearDown(): void {
* Test case: Every group of rating exists (helful and solved posts, only helpful/solved and none)
* @covers \ratings::moodleoverflow_sort_answer_by_ratings()
*/
- public function test_answersorting_everygroup() {
+ public function test_answersorting_everygroup(): void {
// Create helpful, solved, up and downvotes ratings.
$this->create_everygroup();
@@ -132,7 +132,7 @@ public function test_answersorting_everygroup() {
* Test case: One group of rating does not exist
* @covers \ratings::moodleoverflow_sort_answer_by_ratings()
*/
- public function test_answersorting_threegroups() {
+ public function test_answersorting_threegroups(): void {
// Create helpful, solved, up and downvotes ratings.
$this->create_everygroup();
@@ -178,7 +178,7 @@ public function test_answersorting_threegroups() {
* Test case: two groups of rating do not exist
* @covers \ratings::moodleoverflow_sort_answer_by_ratings()
*/
- public function test_answersorting_twogroups() {
+ public function test_answersorting_twogroups(): void {
$this->set_ratingpreferences(0);
// Test case 1: helpful and solved post, only solved posts.
@@ -228,7 +228,7 @@ public function test_answersorting_twogroups() {
* Extended Test Case: If the votesdifference is the same, the post should be sorted by their time of creation/modification.
* @covers \ratings::moodleoverflow_sort_answer_by_ratings()
*/
- public function test_answersorting_onegroup() {
+ public function test_answersorting_onegroup(): void {
$this->set_ratingpreferences(0);
// Test case 1: only solved and helpful posts.
diff --git a/tests/readtracking_test.php b/tests/readtracking_test.php
index a4bfa108d3..015d7f4403 100644
--- a/tests/readtracking_test.php
+++ b/tests/readtracking_test.php
@@ -43,7 +43,7 @@ class readtracking_test extends advanced_testcase {
/**
* Test the logic in the moodleoverflow_can_track_moodleoverflows() function.
*/
- public function test_moodleoverflow_can_track_moodleoverflows() {
+ public function test_moodleoverflow_can_track_moodleoverflows(): void {
// Reset after testing.
$this->resetAfterTest();
@@ -92,7 +92,7 @@ public function test_moodleoverflow_can_track_moodleoverflows() {
/**
* Test the logic in the test_forum_tp_is_tracked() function.
*/
- public function test_moodleoverflow_is_tracked() {
+ public function test_moodleoverflow_is_tracked(): void {
$this->resetAfterTest();
diff --git a/tests/review_test.php b/tests/review_test.php
index b0124c5e90..d6ceeb90e6 100644
--- a/tests/review_test.php
+++ b/tests/review_test.php
@@ -108,12 +108,12 @@ protected function tearDown(): void {
*
* @runInSeparateProcess
*/
- public function test_forum_review_everything() {
+ public function test_forum_review_everything(): void {
global $DB, $CFG;
require_once($CFG->dirroot . '/mod/moodleoverflow/externallib.php');
$options = ['course' => $this->course->id, 'needsreview' => review::EVERYTHING,
- 'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE];
+ 'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE, ];
$posts = $this->create_post($options);
$this->check_mail_records($posts['teacherpost'], $posts['studentpost'], 1, 0, MOODLEOVERFLOW_MAILED_REVIEW_SUCCESS);
@@ -173,12 +173,12 @@ public function test_forum_review_everything() {
*
* @runInSeparateProcess
*/
- public function test_forum_review_only_questions() {
+ public function test_forum_review_only_questions(): void {
global $DB, $CFG;
require_once($CFG->dirroot . '/mod/moodleoverflow/externallib.php');
$options = ['course' => $this->course->id, 'needsreview' => review::QUESTIONS,
- 'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE];
+ 'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE, ];
$posts = $this->create_post($options);
$this->check_mail_records($posts['teacherpost'], $posts['studentpost'], 1, 0, MOODLEOVERFLOW_MAILED_REVIEW_SUCCESS);
@@ -214,9 +214,9 @@ public function test_forum_review_only_questions() {
/**
* Test reviews functionality when reviewing is allowed in admin settings.
*/
- public function test_forum_review_disallowed() {
+ public function test_forum_review_disallowed(): void {
$options = ['course' => $this->course->id, 'needsreview' => review::EVERYTHING,
- 'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE];
+ 'forcesubscribe' => MOODLEOVERFLOW_FORCESUBSCRIBE, ];
set_config('allowreview', 0, 'moodleoverflow');
diff --git a/tests/subscriptions_test.php b/tests/subscriptions_test.php
index 28f5776a9d..2c8651e26e 100644
--- a/tests/subscriptions_test.php
+++ b/tests/subscriptions_test.php
@@ -110,7 +110,7 @@ protected function helper_post_to_moodleoverflow($moodleoverflow, $author) {
/**
* Test to set subscription modes.
*/
- public function test_subscription_modes() {
+ public function test_subscription_modes(): void {
global $DB;
// Reset the database after testing.
@@ -162,7 +162,7 @@ public function test_subscription_modes() {
/**
* Test fetching unsubscribable moodleoverflows.
*/
- public function test_unsubscribable_moodleoverflows() {
+ public function test_unsubscribable_moodleoverflows(): void {
// Reset the database after testing.
$this->resetAfterTest(true);
@@ -211,7 +211,7 @@ public function test_unsubscribable_moodleoverflows() {
/**
* Test that toggeling the moodleoverflow-level subscription for a different user does not affect their discussion-level.
*/
- public function test_moodleoverflow_toggle_as_other() {
+ public function test_moodleoverflow_toggle_as_other(): void {
global $DB;
// Reset the database after testing.
@@ -384,7 +384,7 @@ public function test_moodleoverflow_toggle_as_other() {
/**
* Test that a user unsubscribed from a moodleoverflow is not subscribed to it's discussions by default.
*/
- public function test_moodleoverflow_discussion_subscription_moodleoverflow_unsubscribed() {
+ public function test_moodleoverflow_discussion_subscription_moodleoverflow_unsubscribed(): void {
// Reset the database after the test.
$this->resetAfterTest(true);
@@ -411,7 +411,7 @@ public function test_moodleoverflow_discussion_subscription_moodleoverflow_unsub
/**
* Test that the act of subscribing to a moodleoverflow subscribes the user to it's discussions by default.
*/
- public function test_moodleoverflow_discussion_subscription_moodleoverflow_subscribed() {
+ public function test_moodleoverflow_discussion_subscription_moodleoverflow_subscribed(): void {
// Reset the database after testing.
$this->resetAfterTest(true);
@@ -450,7 +450,7 @@ public function test_moodleoverflow_discussion_subscription_moodleoverflow_subsc
/**
* Test that a user unsubscribed from a moodleoverflow can be subscribed to a discussion.
*/
- public function test_moodleoverflow_discussion_subscription_moodleoverflow_unsubscribed_discussion_subscribed() {
+ public function test_moodleoverflow_discussion_subscription_moodleoverflow_unsubscribed_discussion_subscribed(): void {
// Reset the database after testing.
$this->resetAfterTest(true);
@@ -494,7 +494,7 @@ public function test_moodleoverflow_discussion_subscription_moodleoverflow_unsub
/**
* Test that a user subscribed to a moodleoverflow can be unsubscribed from a discussion.
*/
- public function test_moodleoverflow_discussion_subscription_moodleoverflow_subscribed_discussion_unsubscribed() {
+ public function test_moodleoverflow_discussion_subscription_moodleoverflow_subscribed_discussion_unsubscribed(): void {
// Reset the database after testing.
$this->resetAfterTest(true);
@@ -536,7 +536,7 @@ public function test_moodleoverflow_discussion_subscription_moodleoverflow_subsc
/**
* Test the effect of toggling the discussion subscription status when subscribed to the moodleoverflow.
*/
- public function test_moodleoverflow_discussion_toggle_moodleoverflow_subscribed() {
+ public function test_moodleoverflow_discussion_toggle_moodleoverflow_subscribed(): void {
global $DB;
// Reset the database after testing.
@@ -715,7 +715,7 @@ public function test_moodleoverflow_discussion_toggle_moodleoverflow_subscribed(
/**
* Test the effect of toggling the discussion subscription status when unsubscribed from the moodleoverflow.
*/
- public function test_moodleoverflow_discussion_toggle_moodleoverflow_unsubscribed() {
+ public function test_moodleoverflow_discussion_toggle_moodleoverflow_unsubscribed(): void {
global $DB;
// Reset the database after testing.
@@ -816,7 +816,7 @@ public function test_moodleoverflow_discussion_toggle_moodleoverflow_unsubscribe
* Test that the correct users are returned when fetching subscribed users
* from a moodleoverflow where users can choose to subscribe and unsubscribe.
*/
- public function test_fetch_subscribed_users_subscriptions() {
+ public function test_fetch_subscribed_users_subscriptions(): void {
global $CFG;
// Reset the database after testing.
@@ -859,7 +859,7 @@ public function test_fetch_subscribed_users_subscriptions() {
* Test that the correct users are returned hwen fetching subscribed users from a moodleoverflow where users are forcibly
* subscribed.
*/
- public function test_fetch_subscribed_users_forced() {
+ public function test_fetch_subscribed_users_forced(): void {
// Reset the database after testing.
$this->resetAfterTest(true);
@@ -884,7 +884,7 @@ public function test_fetch_subscribed_users_forced() {
/**
* Test that unusual combinations of discussion subscriptions do not affect the subscribed user list.
*/
- public function test_fetch_subscribed_users_discussion_subscriptions() {
+ public function test_fetch_subscribed_users_discussion_subscriptions(): void {
global $DB;
// Reset after testing.
@@ -970,7 +970,7 @@ public function test_fetch_subscribed_users_discussion_subscriptions() {
/**
* Test whether a user is force-subscribed to a moodleoverflow.
*/
- public function test_force_subscribed_to_moodleoverflow() {
+ public function test_force_subscribed_to_moodleoverflow(): void {
global $DB;
// Reset database after testing.
@@ -1003,7 +1003,7 @@ public function test_force_subscribed_to_moodleoverflow() {
/**
* Test that the subscription cache can be pre-filled.
*/
- public function test_subscription_cache_prefill() {
+ public function test_subscription_cache_prefill(): void {
global $DB;
// Reset the database after testing.
@@ -1037,7 +1037,7 @@ public function test_subscription_cache_prefill() {
/**
* Test that the subscription cache can filled user-at-a-time.
*/
- public function test_subscription_cache_fill() {
+ public function test_subscription_cache_fill(): void {
global $DB;
// Reset the database after testing.
@@ -1069,7 +1069,7 @@ public function test_subscription_cache_fill() {
/**
* Test that the discussion subscription cache can filled course-at-a-time.
*/
- public function test_discussion_subscription_cache_fill_for_course() {
+ public function test_discussion_subscription_cache_fill_for_course(): void {
global $DB;
// Reset the database after testing.
@@ -1122,7 +1122,7 @@ public function test_discussion_subscription_cache_fill_for_course() {
/**
* Test that the discussion subscription cache can be forcibly updated for a user.
*/
- public function test_discussion_subscription_cache_prefill() {
+ public function test_discussion_subscription_cache_prefill(): void {
global $DB;
// Reset the database after testing.
@@ -1189,7 +1189,7 @@ public function test_discussion_subscription_cache_prefill() {
/**
* Test that the discussion subscription cache can filled user-at-a-time.
*/
- public function test_discussion_subscription_cache_fill() {
+ public function test_discussion_subscription_cache_fill(): void {
global $DB;
// Reset the database after testing.
@@ -1262,7 +1262,7 @@ public function test_discussion_subscription_cache_fill() {
* Test that after toggling the moodleoverflow subscription as another user,
* the discussion subscription functionality works as expected.
*/
- public function test_moodleoverflow_subscribe_toggle_as_other_repeat_subscriptions() {
+ public function test_moodleoverflow_subscribe_toggle_as_other_repeat_subscriptions(): void {
global $DB;
// Reset the database after testing.
@@ -1398,7 +1398,7 @@ public function is_subscribable_provider() {
*
* @dataProvider is_subscribable_provider
*/
- public function test_is_subscribable_logged_out($options) {
+ public function test_is_subscribable_logged_out($options): void {
$this->resetAfterTest(true);
// Create a course, with a moodleoverflow.
@@ -1417,7 +1417,7 @@ public function test_is_subscribable_logged_out($options) {
*
* @dataProvider is_subscribable_provider
*/
- public function test_is_subscribable_is_guest($options) {
+ public function test_is_subscribable_is_guest($options): void {
global $DB;
$this->resetAfterTest(true);
@@ -1467,7 +1467,7 @@ public function is_subscribable_loggedin_provider() {
*
* @dataProvider is_subscribable_loggedin_provider
*/
- public function test_is_subscribable_loggedin($options, $expect) {
+ public function test_is_subscribable_loggedin($options, $expect): void {
// Reset the database after testing.
$this->resetAfterTest(true);
diff --git a/tests/userstats_test.php b/tests/userstats_test.php
index 598a92edd4..b6078f1670 100644
--- a/tests/userstats_test.php
+++ b/tests/userstats_test.php
@@ -103,7 +103,7 @@ public function tearDown(): void {
* Test, if a upvote is being counted.
* @covers \userstats_table
*/
- public function test_upvote() {
+ public function test_upvote(): void {
// Teacher upvotes the discussion and the answer of user2.
$this->create_upvote($this->teacher, $this->discussion1[1], $this->answer1);
@@ -117,7 +117,7 @@ public function test_upvote() {
* Test, if a downvote is being counted.
* @covers \userstats_table
*/
- public function test_downvote() {
+ public function test_downvote(): void {
// Teacher downvotes the discussion and the answer of user1.
$this->create_downvote($this->teacher, $this->discussion2[1], $this->answer2);
@@ -131,7 +131,7 @@ public function test_downvote() {
* Test, if the activity is calculated correctly.
* @covers \userstats_table
*/
- public function test_activity() {
+ public function test_activity(): void {
// User1 will rates 3 times.
$this->create_helpful($this->user1, $this->discussion1[1], $this->answer1);
$this->create_upvote($this->user1, $this->discussion1[1], $this->answer1);
@@ -148,7 +148,7 @@ public function test_activity() {
* Test, if the reputation is calculated correctly.
* @covers \userstats_table
*/
- public function test_reputation() {
+ public function test_reputation(): void {
// User1 creates some ratings for user2, Teacher creates some ratings for user2.
$this->create_helpful($this->user1, $this->discussion1[1], $this->answer1);
$this->create_upvote($this->user1, $this->discussion1[1], $this->answer1);
@@ -168,7 +168,7 @@ public function test_reputation() {
* Test, if userstats are calculated correctly if the moodleoverflow is partially anonymous.
* @covers \userstats_table
*/
- public function test_partial_anonymous() {
+ public function test_partial_anonymous(): void {
global $DB;
// Test case: Only topic startes are anonymous.
$this->make_anonymous(1);
@@ -224,7 +224,7 @@ public function test_partial_anonymous() {
* Test, if userstats are calculated correctly if the moodleoverflow is partially anonymous.
* @covers \userstats_table
*/
- public function test_total_anonymous() {
+ public function test_total_anonymous(): void {
// Test case: Only topic startes are anonymous.
$this->make_anonymous(2);
@@ -323,7 +323,7 @@ private function make_anonymous($anonymoussetting) {
private function create_statstable() {
$url = new \moodle_url('/mod/moodleoverflow/userstats.php', ['id' => $this->coursemodule->id,
'courseid' => $this->course->id,
- 'mid' => $this->moodleoverflow->id]);
+ 'mid' => $this->moodleoverflow->id, ]);
$userstatstable = new userstats_table('testtable', $this->course->id, $this->moodleoverflow->id, $url);
$userstatstable->get_table_data();
return $userstatstable->get_usertable();
diff --git a/userstats.php b/userstats.php
index a2984f8e95..1b5eecf165 100644
--- a/userstats.php
+++ b/userstats.php
@@ -57,7 +57,7 @@
if (has_capability('mod/moodleoverflow:viewanyrating', $context) && get_config('moodleoverflow', 'showuserstats')) {
// Print the page header.
$PAGE->set_url('/mod/moodleoverflow/userstats.php', ['id' => $cm->id,
- 'courseid' => $course->id, 'mid' => $moodleoverflow->id]);
+ 'courseid' => $course->id, 'mid' => $moodleoverflow->id, ]);
$PAGE->set_title(format_string('User statistics'));
$PAGE->set_heading(format_string('User statistics of course: ' . $course->fullname));
From bc3822241d98b4fe313a9e933283d97570c79cae Mon Sep 17 00:00:00 2001
From: TamaroWalter
Date: Wed, 13 Mar 2024 16:20:58 +0100
Subject: [PATCH 2/2] codechecker fixes
---
classes/privacy/data_export_helper.php | 4 ++--
locallib.php | 11 +++--------
mod_form.php | 12 ------------
post.php | 3 ++-
tests/review_test.php | 9 ++++++---
tests/subscriptions_test.php | 3 +++
6 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/classes/privacy/data_export_helper.php b/classes/privacy/data_export_helper.php
index ed0bfb3aa6..858ae859f0 100644
--- a/classes/privacy/data_export_helper.php
+++ b/classes/privacy/data_export_helper.php
@@ -51,7 +51,7 @@ public static function export_discussion_data($userid, array $mappings) {
FROM {moodleoverflow} mof
INNER JOIN {moodleoverflow_discussions} d ON d.moodleoverflow = mof.id
LEFT JOIN {moodleoverflow_discuss_subs} dsub ON dsub.discussion = d.id
- WHERE mof.id ${foruminsql}
+ WHERE mof.id {$foruminsql}
AND (
d.userid = :discussionuserid OR
d.usermodified = :dmuserid OR
@@ -113,7 +113,7 @@ public static function export_all_posts($userid, array $mappings) {
INNER JOIN {moodleoverflow_posts} p ON p.discussion = d.id
LEFT JOIN {moodleoverflow_read} fr ON fr.postid = p.id
LEFT JOIN {moodleoverflow_ratings} rat ON rat.postid = p.id
- WHERE mof.id ${foruminsql} AND
+ WHERE mof.id {$foruminsql} AND
(
p.userid = :postuserid OR
fr.userid = :readuserid OR
diff --git a/locallib.php b/locallib.php
index 10632384a6..821ba14d95 100644
--- a/locallib.php
+++ b/locallib.php
@@ -928,12 +928,7 @@ function moodleoverflow_print_discussion($course, $cm, $moodleoverflow, $discuss
// Retrieve all posts of the discussion.
$posts = moodleoverflow_get_all_discussion_posts($discussion->id, $istracked, $modulecontext);
- /*$newpost = [];
- foreach($posts as $posti) {
- $newpost[] = $posti->message;
- }
- var_dump($newpost);
- */$usermapping = anonymous::get_userid_mapping($moodleoverflow, $discussion->id);
+ $usermapping = anonymous::get_userid_mapping($moodleoverflow, $discussion->id);
// Start with the parent post.
$post = $posts[$post->id];
@@ -1856,10 +1851,10 @@ function moodleoverflow_delete_post($post, $deletechildren, $cm, $moodleoverflow
$attachments = $fs->get_area_files($context->id, 'mod_moodleoverflow', 'attachment',
$post->id, "filename", true);
foreach ($attachments as $attachment) {
- // Get file
+ // Get file.
$file = $fs->get_file($context->id, 'mod_moodleoverflow', 'attachment', $post->id,
$attachment->get_filepath(), $attachment->get_filename());
- // Delete it if it exists
+ // Delete it if it exists.
if ($file) {
$file->delete();
}
diff --git a/mod_form.php b/mod_form.php
index a605ca3468..4e45e7079a 100644
--- a/mod_form.php
+++ b/mod_form.php
@@ -265,16 +265,4 @@ public function data_postprocessing($data) {
$data->coursewidereputation = false;
}
}
-
- /**
- * Set
- * @param $default_values
- * @return void
- */
- public function data_preprocessing(&$defaultvalues) {
- parent::data_preprocessing($defaultvalues);
-
- // Fill the anonymous and the grade options with the values that were set.
-
- }
}
diff --git a/post.php b/post.php
index 976c8f538c..e56eaa477e 100644
--- a/post.php
+++ b/post.php
@@ -490,7 +490,8 @@
empty($post->id) ? null : $post->id,
mod_moodleoverflow_post_form::attachment_options($moodleoverflow));
-if ($draftitemid && $edit && \mod_moodleoverflow\anonymous::is_post_anonymous($discussion, $moodleoverflow, $post->userid) && $post->userid != $USER->id) {
+if ($draftitemid && $edit && \mod_moodleoverflow\anonymous::is_post_anonymous($discussion, $moodleoverflow, $post->userid)
+ && $post->userid != $USER->id) {
$usercontext = context_user::instance($USER->id);
$anonymousstr = get_string('anonymous', 'moodleoverflow');
foreach (get_file_storage()->get_area_files($usercontext->id, 'user', 'draft', $draftitemid) as $file) {
diff --git a/tests/review_test.php b/tests/review_test.php
index d6ceeb90e6..13d54ce7af 100644
--- a/tests/review_test.php
+++ b/tests/review_test.php
@@ -292,15 +292,18 @@ private function create_post($options) {
private function check_mail_records($teacherpost, $studentpost, $review1, $review2, $mailed) {
global $DB;
- $this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_PENDING, 'reviewed' => $review1, 'timereviewed' => null],
+ $this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_PENDING,
+ 'reviewed' => $review1, 'timereviewed' => null],
$DB->get_record('moodleoverflow_posts', ['id' => $teacherpost->id]));
- $this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_PENDING, 'reviewed' => $review2, 'timereviewed' => null],
+ $this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_PENDING,
+ 'reviewed' => $review2, 'timereviewed' => null],
$DB->get_record('moodleoverflow_posts', ['id' => $studentpost->id]));
$this->run_send_mails();
$this->run_send_mails(); // Execute twice to ensure no duplicate mails.
- $this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_SUCCESS, 'reviewed' => $review1, 'timereviewed' => null],
+ $this->assert_matches_properties(['mailed' => MOODLEOVERFLOW_MAILED_SUCCESS,
+ 'reviewed' => $review1, 'timereviewed' => null],
$DB->get_record('moodleoverflow_posts', ['id' => $teacherpost->id]));
$this->assert_matches_properties(['mailed' => $mailed, 'reviewed' => $review2, 'timereviewed' => null],
$DB->get_record('moodleoverflow_posts', ['id' => $studentpost->id]));
diff --git a/tests/subscriptions_test.php b/tests/subscriptions_test.php
index 2c8651e26e..f34633ad30 100644
--- a/tests/subscriptions_test.php
+++ b/tests/subscriptions_test.php
@@ -1397,6 +1397,7 @@ public function is_subscribable_provider() {
* @param array $options
*
* @dataProvider is_subscribable_provider
+ * @return void
*/
public function test_is_subscribable_logged_out($options): void {
$this->resetAfterTest(true);
@@ -1416,6 +1417,7 @@ public function test_is_subscribable_logged_out($options): void {
* @param array $options
*
* @dataProvider is_subscribable_provider
+ * @return void
*/
public function test_is_subscribable_is_guest($options): void {
global $DB;
@@ -1466,6 +1468,7 @@ public function is_subscribable_loggedin_provider() {
* @param bool $expect
*
* @dataProvider is_subscribable_loggedin_provider
+ * @return void
*/
public function test_is_subscribable_loggedin($options, $expect): void {
// Reset the database after testing.