From 2eaf7b4d8fb53a056363ef32f0ce84d05e86cc6f Mon Sep 17 00:00:00 2001 From: David Szkiba Date: Tue, 1 Oct 2024 13:38:00 +0200 Subject: [PATCH] GH-620 linting fixes --- classes/task/cancel_expired_attempts.php | 3 +++ settings.php | 6 +++--- tests/task/cancel_expired_attempts_test.php | 18 +++++++++++++----- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/classes/task/cancel_expired_attempts.php b/classes/task/cancel_expired_attempts.php index a1b0db9fa..9a2faf519 100755 --- a/classes/task/cancel_expired_attempts.php +++ b/classes/task/cancel_expired_attempts.php @@ -34,6 +34,8 @@ use mod_adaptivequiz\local\attempt\attempt_state; use stdClass; +defined('MOODLE_INTERNAL') || die(); + global $CFG; require_once("$CFG->dirroot/mod/adaptivequiz/locallib.php"); @@ -155,6 +157,7 @@ public function execute() { * @param int $timecreated Timestamp when the attempt was created * @param ?int $quizmaxtime Maximum time specified by the quiz * @param int $defaultmaxtime Default maximum time + * @param int $now * @return bool */ public function exceeds_maxtime(int $timecreated, ?int $quizmaxtime, int $defaultmaxtime, int $now): bool { diff --git a/settings.php b/settings.php index 7b5e48567..eaf281a8b 100644 --- a/settings.php +++ b/settings.php @@ -124,7 +124,7 @@ 'local_catquiz/maximum_attempt_duration_hours', get_string('maxattemptduration', 'local_catquiz'), get_string('maxattemptduration_desc', 'local_catquiz'), - 24, // Default value - PARAM_INT // Expect integer type - )); + 24, // Default value. + PARAM_INT // Expect integer type. + )); } diff --git a/tests/task/cancel_expired_attempts_test.php b/tests/task/cancel_expired_attempts_test.php index 183496ff9..93baa1368 100644 --- a/tests/task/cancel_expired_attempts_test.php +++ b/tests/task/cancel_expired_attempts_test.php @@ -21,9 +21,6 @@ * @author David Szkiba * @copyright 2023 Georg Maißer * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @autor David Szkiba - * @copirignt 2023 Georg Maißer - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace local_catquiz; @@ -47,10 +44,21 @@ final class cancel_expired_attempts_test extends basic_testcase { /** * Test if the newton raphson multi stable function returns expected outputs. * - * @dataProvider attempt_expiration_is_detected_correctly_provider + * @param int $attemptcreated + * @param ?int $quizmaxtime + * @param int $defaultmaxtime + * @param int $now + * @param bool $expected * @return void + * @dataProvider attempt_expiration_is_detected_correctly_provider */ - public function test_attempt_expiration_is_detected_correctly(int $attemptcreated, ?int $quizmaxtime, int $defaultmaxtime, int $now, bool $expected) { + public function test_attempt_expiration_is_detected_correctly( + int $attemptcreated, + ?int $quizmaxtime, + int $defaultmaxtime, + int $now, + bool $expected + ): void { $task = new cancel_expired_attempts(); $shouldbecompleted = $task->exceeds_maxtime($attemptcreated, $quizmaxtime, $defaultmaxtime, $now); $this->assertEquals($expected, $shouldbecompleted);