Skip to content

Commit e0616df

Browse files
author
Laur0r
authored
Merge pull request #195 from learnweb/fix-codestyles
Fix codestyle and pin moodle-plugin-ci version
2 parents 8c7aaab + fda9c06 commit e0616df

17 files changed

+367
-422
lines changed

.github/workflows/moodle-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
5151
- name: Initialise moodle-plugin-ci
5252
run: |
53-
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
53+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci 4.5.4
5454
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
5555
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
5656
sudo locale-gen en_AU.UTF-8
@@ -173,7 +173,7 @@ jobs:
173173
174174
- name: Initialise moodle-plugin-ci
175175
run: |
176-
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
176+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci 4.5.4
177177
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
178178
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
179179
sudo locale-gen en_AU.UTF-8

classes/capabilities.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ public static function has(string $capability, context $context, $userid = null)
9494

9595
$key = "$userid:$context->id:$capability";
9696

97-
if (!isset($cache[$key])) {
98-
$cache[$key] = has_capability($capability, $context, $userid);
97+
if (!isset(self::$cache[$key])) {
98+
self::$cache[$key] = has_capability($capability, $context, $userid);
9999
}
100100

101-
return $cache[$key];
101+
return self::$cache[$key];
102102
}
103103

104104
}

classes/output/moodleoverflow_email.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ class moodleoverflow_email implements \renderable, \templatable {
7373
/**
7474
* Whether the user can reply to this post.
7575
*
76-
* @var boolean $canreply
76+
* @var bool $canreply
7777
*/
7878
protected $canreply = false;
7979

8080
/**
8181
* Whether to override forum display when displaying usernames.
82-
* @var boolean $viewfullnames
82+
* @var bool $viewfullnames
8383
*/
8484
protected $viewfullnames = false;
8585

classes/privacy/data_export_helper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//
1414
// You should have received a copy of the GNU General Public License
1515
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
1617
/**
1718
* Privacy Subsystem implementation for mod_moodleoverflow.
1819
*

classes/privacy/provider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class provider implements
5050
*
5151
* @return collection the updated collection of metadata items.
5252
*/
53-
public static function get_metadata(collection $collection) : collection {
53+
public static function get_metadata(collection $collection): collection {
5454
$collection->add_database_table('moodleoverflow_discussions',
5555
[
5656
'name' => 'privacy:metadata:moodleoverflow_discussions:name',
@@ -135,7 +135,7 @@ public static function get_metadata(collection $collection) : collection {
135135
*
136136
* @return contextlist $contextlist The list of contexts used in this plugin.
137137
*/
138-
public static function get_contexts_for_userid(int $userid) : contextlist {
138+
public static function get_contexts_for_userid(int $userid): contextlist {
139139
// Fetch all Moodleoverflow discussions, moodleoverflow posts, ratings, tracking settings and subscriptions.
140140
$sql = "SELECT c.id
141141
FROM {context} c

grade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* @copyright 2017 Kennet Winter <[email protected]>
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323
*/
24+
2425
require_once(__DIR__ . "/../../config.php");
2526
require_login();
2627
$id = required_param('id', PARAM_INT);

lang/en/moodleoverflow.php

Lines changed: 330 additions & 392 deletions
Large diffs are not rendered by default.

tests/behat/behat_mod_moodleoverflow.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ protected function find_moodleoverflow_discussion_card(string $discussiontitle):
159159
$discussiontitle . '"]]');
160160
}
161161

162+
// phpcs:disable moodle.Files.LineLength.TooLong
162163
/**
163164
* Checks that an element and selector type exists in another element and selector type on the current page.
164165
*
@@ -171,6 +172,7 @@ protected function find_moodleoverflow_discussion_card(string $discussiontitle):
171172
* @param string $discussiontitle The discussion title
172173
*/
173174
public function should_exist_in_the_moodleoverflow_discussion_card($element, $selectortype, $discussiontitle) {
175+
// phpcs:enable
174176
// Get the container node.
175177
$containernode = $this->find_moodleoverflow_discussion_card($discussiontitle);
176178

@@ -182,6 +184,7 @@ public function should_exist_in_the_moodleoverflow_discussion_card($element, $se
182184
$this->find($selectortype, $element, $exception, $containernode);
183185
}
184186

187+
// phpcs:disable moodle.Files.LineLength.TooLong
185188
/**
186189
* Click on the element of the specified type which is located inside the second element.
187190
*
@@ -191,6 +194,7 @@ public function should_exist_in_the_moodleoverflow_discussion_card($element, $se
191194
* @param string $discussiontitle The discussion title
192195
*/
193196
public function i_click_on_in_the_moodleoverflow_discussion_card($element, $selectortype, $discussiontitle) {
197+
// phpcs:enable
194198
// Get the container node.
195199
$containernode = $this->find_moodleoverflow_discussion_card($discussiontitle);
196200

@@ -204,6 +208,7 @@ public function i_click_on_in_the_moodleoverflow_discussion_card($element, $sele
204208
$node->click();
205209
}
206210

211+
// phpcs:disable moodle.Files.LineLength.TooLong
207212
/**
208213
* Checks that an element and selector type does not exist in another element and selector type on the current page.
209214
*
@@ -216,6 +221,7 @@ public function i_click_on_in_the_moodleoverflow_discussion_card($element, $sele
216221
* @param string $discussiontitle The discussion title
217222
*/
218223
public function should_not_exist_in_the_moodleoverflow_discussion_card($element, $selectortype, $discussiontitle) {
224+
// phpcs:enable
219225
// Get the container node.
220226
$containernode = $this->find_moodleoverflow_discussion_card($discussiontitle);
221227

tests/dailymail_test.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
* @package mod_moodleoverflow
3939
* @copyright 2023 Tamaro Walter
4040
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
41+
* @covers \mod_moodleoverflow\task\send_daily_mail::execute
4142
*/
42-
class dailymail_test extends \advanced_testcase {
43+
final class dailymail_test extends \advanced_testcase {
4344

4445
/** @var \stdClass collection of messages */
4546
private $sink;
@@ -138,7 +139,6 @@ private function helper_run_send_mails() {
138139

139140
/**
140141
* Test if the task send_daily_mail sends a mail to the user.
141-
* @covers \send_daily_mail::execute
142142
*/
143143
public function test_mail_delivery(): void {
144144
// Create user with maildigest = on.
@@ -154,7 +154,6 @@ public function test_mail_delivery(): void {
154154

155155
/**
156156
* Test if the task send_daily_mail does not sends email from posts that are not in the course of the user.
157-
* @return void
158157
*/
159158
public function test_delivery_not_enrolled(): void {
160159
// Create user with maildigest = on.
@@ -201,7 +200,6 @@ public function test_delivery_not_enrolled(): void {
201200

202201
/**
203202
* Test if the content of the mail matches the supposed content.
204-
* @covers \send_daily_mail::execute
205203
*/
206204
public function test_content_of_mail_delivery(): void {
207205

@@ -236,7 +234,6 @@ public function test_content_of_mail_delivery(): void {
236234

237235
/**
238236
* Test if the task does not send a mail when maildigest = 0
239-
* @covers \send_daily_mail::execute
240237
*/
241238
public function test_mail_not_send(): void {
242239
// Creat user with daily_mail = off.
@@ -252,7 +249,6 @@ public function test_mail_not_send(): void {
252249

253250
/**
254251
* Test if database is updated after sending a mail
255-
* @covers \send_daily_mail::execute
256252
*/
257253
public function test_records_removed(): void {
258254
global $DB;

tests/locallib_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* @copyright 2017 Kennet Winter <[email protected]>
3737
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3838
*/
39-
class locallib_test extends advanced_testcase {
39+
final class locallib_test extends advanced_testcase {
4040

4141
public function setUp(): void {
4242
\mod_moodleoverflow\subscriptions::reset_moodleoverflow_cache();

0 commit comments

Comments
 (0)