From d7eb27085d72719bdacf7a1c95c14cc88f0a29de Mon Sep 17 00:00:00 2001 From: Renaat Debleu Date: Wed, 11 Sep 2024 22:57:58 +0000 Subject: [PATCH 1/2] issue_#39 --- classes/plugin.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/classes/plugin.php b/classes/plugin.php index 56c251e..c9757fe 100644 --- a/classes/plugin.php +++ b/classes/plugin.php @@ -220,9 +220,7 @@ public function enrol_user( if (isset($instance->roleid)) { $roleid = $instance->roleid; } - if (isset($instance->enrolstartdate)) { - $timestart = $instance->enrolstartdate; - } + $timestart = isset($instance->enrolstartdate) ? $instance->enrolstartdate : time(); if (isset($instance->enrolenddate)) { $timeend = $instance->enrolenddate; } From db3b3e720529ad41b31b3ba8fe3e2026e95f7a26 Mon Sep 17 00:00:00 2001 From: Renaat Debleu Date: Wed, 11 Sep 2024 23:25:42 +0000 Subject: [PATCH 2/2] codefix --- tests/backup_test.php | 1 + tests/bulk_test.php | 2 ++ tests/enrol_test.php | 2 ++ tests/manager_test.php | 1 + tests/other_test.php | 1 + tests/time_enrolled_test.php | 1 + 6 files changed, 8 insertions(+) diff --git a/tests/backup_test.php b/tests/backup_test.php index 8428c61..c5837ad 100644 --- a/tests/backup_test.php +++ b/tests/backup_test.php @@ -52,6 +52,7 @@ final class backup_test extends advanced_testcase { */ protected function setUp(): void { global $CFG, $DB; + parent::setUp(); $CFG->enablecompletion = true; $this->resetAfterTest(true); diff --git a/tests/bulk_test.php b/tests/bulk_test.php index c499454..4dc4372 100644 --- a/tests/bulk_test.php +++ b/tests/bulk_test.php @@ -44,6 +44,7 @@ public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->libdir . '/formslib.php'); require_once($CFG->dirroot . '/enrol/locallib.php'); + parent::setUpBeforeClass(); } /** @@ -51,6 +52,7 @@ public static function setUpBeforeClass(): void { */ protected function setUp(): void { global $CFG; + parent::setUp(); $CFG->enablecompletion = true; $this->resetAfterTest(true); $enabled = enrol_get_plugins(true); diff --git a/tests/enrol_test.php b/tests/enrol_test.php index 85a1562..f72a2bd 100644 --- a/tests/enrol_test.php +++ b/tests/enrol_test.php @@ -66,6 +66,7 @@ public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->libdir . '/formslib.php'); require_once($CFG->dirroot . '/enrol/locallib.php'); + parent::setUpBeforeClass(); } /** @@ -73,6 +74,7 @@ public static function setUpBeforeClass(): void { */ protected function setUp(): void { global $CFG, $DB; + parent::setUp(); $CFG->enablecompletion = true; $this->resetAfterTest(true); diff --git a/tests/manager_test.php b/tests/manager_test.php index 6815868..9043c93 100644 --- a/tests/manager_test.php +++ b/tests/manager_test.php @@ -49,6 +49,7 @@ final class manager_test extends \advanced_testcase { */ protected function setUp(): void { global $CFG, $DB; + parent::setUp(); $CFG->enablecompletion = true; $this->resetAfterTest(true); $enabled = enrol_get_plugins(true); diff --git a/tests/other_test.php b/tests/other_test.php index 5684787..e2412be 100644 --- a/tests/other_test.php +++ b/tests/other_test.php @@ -47,6 +47,7 @@ final class other_test extends \advanced_testcase { */ protected function setUp(): void { global $CFG; + parent::setUp(); $CFG->enablecompletion = true; $this->resetAfterTest(true); $enabled = enrol_get_plugins(true); diff --git a/tests/time_enrolled_test.php b/tests/time_enrolled_test.php index c7c848d..182a70e 100644 --- a/tests/time_enrolled_test.php +++ b/tests/time_enrolled_test.php @@ -41,6 +41,7 @@ final class time_enrolled_test extends \advanced_testcase { protected function setUp(): void { global $CFG; require_once($CFG->dirroot . '/enrol/locallib.php'); + parent::setUp(); $CFG->enablecompletion = true; $this->resetAfterTest(true); $enabled = enrol_get_plugins(true);