Skip to content

Commit

Permalink
GH-620 linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidszkiba committed Oct 1, 2024
1 parent 2b97250 commit 2eaf7b4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
3 changes: 3 additions & 0 deletions classes/task/cancel_expired_attempts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
));
}
18 changes: 13 additions & 5 deletions tests/task/cancel_expired_attempts_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
* @author David Szkiba <[email protected]>
* @copyright 2023 Georg Maißer <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @autor David Szkiba <[email protected]>
* @copirignt 2023 Georg Maißer <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace local_catquiz;
Expand All @@ -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);
Expand Down

0 comments on commit 2eaf7b4

Please sign in to comment.