Skip to content

Commit

Permalink
copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
rdebleu committed May 11, 2024
1 parent eb3c642 commit a94a910
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
4 changes: 2 additions & 2 deletions classes/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,14 @@ private function is_active($instance): bool {
*/
public function has_bulk_operations(\course_enrolment_manager $manager): bool {
if ($this->singleinstance == false) {
$instances = array_values($manager->get_enrolment_instances(false));
$instances = $manager->get_enrolment_instances();
$i = 0;
foreach ($instances as $instance) {
if ($instance->enrol == 'coursecompleted') {
$i++;
}
}
$this->singleinstance = (bool)($i === 1);
$this->singleinstance = $i === 1;
}
return $this->singleinstance;
}
Expand Down
2 changes: 1 addition & 1 deletion db/uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* Coursecompleted enrolment plugin uninstall.
*
* @package enrol_coursecompleted
* @copyright eWallah
* @copyright eWallah (www.eWallah.net)
* @author Renaat Debleu <info@eWallah.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
2 changes: 1 addition & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Coursecompleted enrolment empty library.
*
* @package enrol_coursecompleted
* @copyright 2024 eWallah (www.eWallah.net)
* @copyright eWallah (www.eWallah.net)
* @author Renaat Debleu <info@eWallah.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
30 changes: 27 additions & 3 deletions tests/enrol_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ protected function setUp(): void {
$this->course2 = $generator->create_course(['shortname' => 'A2', 'enablecompletion' => 1]);
$this->course3 = $generator->create_course(['shortname' => 'A3', 'enablecompletion' => 1]);
$this->course4 = $generator->create_course(['shortname' => 'A4', 'enablecompletion' => 1]);
$course5 = $generator->create_course(['shortname' => 'A5', 'enablecompletion' => 1]);
$course6 = $generator->create_course(['shortname' => 'A6', 'enablecompletion' => 1]);
$studentrole = $DB->get_field('role', 'id', ['shortname' => 'student']);
$this->setAdminUser();
$this->plugin = enrol_get_plugin('coursecompleted');
Expand All @@ -94,6 +96,13 @@ protected function setUp(): void {
]
);
$this->instance = $DB->get_record('enrol', ['id' => $id]);
$this->plugin->add_instance(
$this->course3,
[
'customint1' => $this->course2->id,
'roleid' => $studentrole,
]
);
$this->plugin->add_instance(
$this->course4,
[
Expand All @@ -102,12 +111,27 @@ protected function setUp(): void {
]
);
$this->plugin->add_instance(
$this->course3,
$course5,
[
'customint1' => $this->course2->id,
'customint1' => $this->course4->id,
'roleid' => $studentrole,
]
);
$this->plugin->add_instance(
$course6,
[
'customint1' => $course5->id,
'roleid' => $studentrole,
]
);
$this->plugin->add_instance(
$this->course4,
[
'customint1' => $course6->id,
'roleid' => $studentrole,
]
);

$this->student = $generator->create_and_enrol($this->course1, 'student');
}

Expand Down Expand Up @@ -207,7 +231,7 @@ public function test_build_course_path(): void {
$instances = $DB->get_records('enrol', ['enrol' => 'coursecompleted']);
foreach ($instances as $instance) {
$path = \phpunit_util::call_internal_method($plug, 'build_course_path', [$instance], '\enrol_coursecompleted_plugin');
$this->assertCount(4, $path);
$this->assertGreaterThan(4, $path);
}
}

Expand Down

0 comments on commit a94a910

Please sign in to comment.