Skip to content

Commit

Permalink
Merge branch 'main' of github.com:ewallah/moodle-enrol_coursecompleted
Browse files Browse the repository at this point in the history
  • Loading branch information
rdebleu committed Sep 14, 2024
2 parents c2cd30b + db3b3e7 commit 725c40e
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 3 deletions.
4 changes: 1 addition & 3 deletions classes/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions tests/backup_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions tests/bulk_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ public static function setUpBeforeClass(): void {
global $CFG;
require_once($CFG->libdir . '/formslib.php');
require_once($CFG->dirroot . '/enrol/locallib.php');
parent::setUpBeforeClass();
}

/**
* Tests initial setup.
*/
protected function setUp(): void {
global $CFG;
parent::setUp();
$CFG->enablecompletion = true;
$this->resetAfterTest(true);
$enabled = enrol_get_plugins(true);
Expand Down
2 changes: 2 additions & 0 deletions tests/enrol_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ public static function setUpBeforeClass(): void {
global $CFG;
require_once($CFG->libdir . '/formslib.php');
require_once($CFG->dirroot . '/enrol/locallib.php');
parent::setUpBeforeClass();
}

/**
* Tests initial setup.
*/
protected function setUp(): void {
global $CFG, $DB;
parent::setUp();

$CFG->enablecompletion = true;
$this->resetAfterTest(true);
Expand Down
1 change: 1 addition & 0 deletions tests/manager_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions tests/other_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions tests/time_enrolled_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 725c40e

Please sign in to comment.