Skip to content

Commit

Permalink
page
Browse files Browse the repository at this point in the history
  • Loading branch information
ewallah committed Jun 3, 2018
1 parent a590718 commit 072a8cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/behat/enrol_coursecompleted.feature
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Feature: Enrolment on course completion
And I log out
And I log in as "user2"
And I am on "Course 2" course homepage
Then I should not see "You will be enrolled in this course when"
Then I should see "You will be enrolled in this course when"
And I log out
And I log in as "user1"
And I am on "Course 2" course homepage
Expand Down
11 changes: 8 additions & 3 deletions tests/coursecompleted_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function test_privacy() {
* Test library.
*/
public function test_library() {
global $DB, $PAGE;
global $DB;
$this->enable_plugin();
$plugin = enrol_get_plugin('coursecompleted');
$generator = $this->getDataGenerator();
Expand Down Expand Up @@ -181,19 +181,24 @@ public function test_library() {
* Test manage.
*/
public function test_manage() {
global $DB, $PAGE;
global $DB;
$this->enable_plugin();
$plugin = enrol_get_plugin('coursecompleted');
$generator = $this->getDataGenerator();
$course1 = $generator->create_course(['shortname' => 'A1', 'enablecompletion' => 1]);
$course2 = $generator->create_course(['shortname' => 'A2', 'enablecompletion' => 1]);
$this->setAdminUser();
$id = $plugin->add_instance($course1, ['customint1' => $course2->id, 'roleid' => 5, 'name' => 'test']);
$PAGE->set_url("/enrol/coursecompleted/manage.php?enrolid=$id");
$student = $generator->create_user();
$manualplugin = enrol_get_plugin('manual');
$instance1 = $DB->get_record('enrol', ['courseid' => $course2->id, 'enrol' => 'manual'], '*', MUST_EXIST);
$manualplugin->enrol_user($instance1, $student->id);
$instance = $DB->get_record('enrol', ['id' => $id]);
$page = new moodle_page();
$page->set_context(context_course::instance($course1->id));
$page->set_course($course1);
$page->set_pagelayout('standard');
$page->set_pagetype('course-view');
$page->set_url("/enrol/coursecompleted/manage.php?enrolid=$id");
}
}

0 comments on commit 072a8cb

Please sign in to comment.