Skip to content

Commit fdfec0e

Browse files
committed
code checking and cleaning
1 parent 3003623 commit fdfec0e

7 files changed

+79
-32
lines changed

classes/ratings.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public static function moodleoverflow_sort_answers_by_ratings($posts) {
350350
$neworder[$post->id] = $post;
351351
}
352352

353-
// return now the sorted posts.
353+
// Return now the sorted posts.
354354
return $neworder;
355355
}
356356

@@ -813,6 +813,12 @@ public static function moodleoverflow_user_can_rate($post, $modulecontext, $user
813813
&& $post->reviewed == 1;
814814
}
815815

816+
/**
817+
* Sorts answerposts of a discussion with quicksort algorithm
818+
* @param array $posts the posts that are being sorted
819+
* @param int $low the index from where the sorting begins
820+
* @param int $high the index until the array is being sorted
821+
*/
816822
private static function moodleoverflow_quicksort_post_by_votes(array &$posts, $low, $high) {
817823
if ($low >= $high) {
818824
return;

classes/task/send_daily_mail.php

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424
namespace mod_moodleoverflow\task;
2525

26-
defined('MOODLE_INTERNAL') || die();
2726
/**
2827
* This task sends a daily mail of unread posts
2928
*/

locallib.php

+3
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,7 @@ function moodleoverflow_user_can_post($modulecontext, $posttoreplyto, $considerr
921921
* @param stdClass $moodleoverflow The moodleoverflow object
922922
* @param stdClass $discussion The discussion object
923923
* @param stdClass $post The post object
924+
* @param bool $multiplemarks The setting of multiplemarks (default: multiplemarks are not allowed)
924925
*/
925926
function moodleoverflow_print_discussion($course, $cm, $moodleoverflow, $discussion, $post, $multiplemarks = false) {
926927
global $USER;
@@ -1118,6 +1119,7 @@ function moodleoverflow_get_all_discussion_posts($discussionid, $tracking, $modc
11181119
* @param bool $iscomment
11191120
* @param array $usermapping
11201121
* @param int $level
1122+
* @param bool $multiplemarks setting of multiplemarks
11211123
* @return void|null
11221124
* @throws coding_exception
11231125
* @throws dml_exception
@@ -1494,6 +1496,7 @@ function moodleoverflow_print_post($post, $discussion, $moodleoverflow, $cm, $co
14941496
* @param array $posts Array of posts within the discussion
14951497
* @param bool $iscomment Whether the current post is a comment
14961498
* @param array $usermapping
1499+
* @param bool $multiplemarks
14971500
* @return string
14981501
* @throws coding_exception
14991502
* @throws dml_exception

tests/behat/behat_mod_moodleoverflow.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ protected function find_moodleoverflow_discussion_card(string $discussiontitle):
128128
*
129129
* This step is for advanced users, use it if you don't find anything else suitable for what you need.
130130
*
131-
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should exist in the "(?P<element2_string>(?:[^"]|\\")*)" moodleoverflow discussion card$/
131+
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should exist in the
132+
* "(?P<element2_string>(?:[^"]|\\")*)" moodleoverflow discussion card$/
132133
* @throws ElementNotFoundException Thrown by behat_base::find
133134
* @param string $element The locator of the specified selector
134135
* @param string $selectortype The selector type
@@ -149,7 +150,8 @@ public function should_exist_in_the_moodleoverflow_discussion_card($element, $se
149150
/**
150151
* Click on the element of the specified type which is located inside the second element.
151152
*
152-
* @When /^I click on "(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" in the "(?P<element2_string>(?:[^"]|\\")*)" moodleoverflow discussion card$/
153+
* @When /^I click on "(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" in the
154+
* "(?P<element2_string>(?:[^"]|\\")*)" moodleoverflow discussion card$/
153155
* @param string $element Element we look for
154156
* @param string $selectortype The type of what we look for
155157
* @param string $discussiontitle The discussion title
@@ -173,7 +175,8 @@ public function i_click_on_in_the_moodleoverflow_discussion_card($element, $sele
173175
*
174176
* This step is for advanced users, use it if you don't find anything else suitable for what you need.
175177
*
176-
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should not exist in the "(?P<element2_string>(?:[^"]|\\")*)" moodleoverflow discussion card$/
178+
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should not exist in the
179+
* "(?P<element2_string>(?:[^"]|\\")*)" moodleoverflow discussion card$/
177180
* @throws ExpectationException
178181
* @param string $element The locator of the specified selector
179182
* @param string $selectortype The selector type

tests/dailymail_test.php

+4
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ private function helper_run_send_mails() {
134134

135135
/**
136136
* Test if the task send_daily_mail sends a mail to the user.
137+
* @covers \send_daily_mail::execute
137138
*/
138139
public function test_mail_delivery() {
139140

@@ -151,6 +152,7 @@ public function test_mail_delivery() {
151152

152153
/**
153154
* Test if the content of the mail matches the supposed content.
155+
* @covers \send_daily_mail::execute
154156
*/
155157
public function test_content_of_mail_delivery() {
156158

@@ -185,6 +187,7 @@ public function test_content_of_mail_delivery() {
185187

186188
/**
187189
* Test if the task does not send a mail when maildigest = 0
190+
* @covers \send_daily_mail::execute
188191
*/
189192
public function test_mail_not_send() {
190193
// Creat user with daily_mail = off.
@@ -200,6 +203,7 @@ public function test_mail_not_send() {
200203

201204
/**
202205
* Test if database is updated after sending a mail
206+
* @covers \send_daily_mail::execute
203207
*/
204208
public function test_records_removed() {
205209
global $DB;

0 commit comments

Comments
 (0)