Skip to content

Commit

Permalink
travis
Browse files Browse the repository at this point in the history
  • Loading branch information
ewallah committed Jun 4, 2018
1 parent e2298be commit 86f496d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
13 changes: 4 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
language: php

notifications:
email:
recipients:
- rdebleu@eWallah.net

sudo: required

addons:
Expand All @@ -22,14 +17,14 @@ cache:
- $HOME/.npm

php:
#- 7.0
- 7.0
- 7.2

env:
#- DB=pgsql MOODLE_BRANCH=master
- DB=pgsql MOODLE_BRANCH=master
- DB=pgsql MOODLE_BRANCH=MOODLE_35_STABLE
#- DB=mysqli MOODLE_BRANCH=master
#- DB=mysqli MOODLE_BRANCH=MOODLE_35_STABLE
- DB=mysqli MOODLE_BRANCH=master
- DB=mysqli MOODLE_BRANCH=MOODLE_35_STABLE

before_install:
- phpenv config-rm xdebug.ini
Expand Down
21 changes: 20 additions & 1 deletion tests/coursecompleted_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class enrol_coursecompleted_testcase extends advanced_testcase {
*
*/
protected function setUp() {
global $DB;
global $CFG, $DB;
$CFG->enablecompletion = true;
$this->resetAfterTest(true);
$this->enable_plugin();
$generator = $this->getDataGenerator();
Expand Down Expand Up @@ -134,6 +135,24 @@ public function test_enrolled() {
$this->assertCount(1, $manager2->get_user_enrolments($this->student->id));
}

/**
* Test if user is enrolled after completing a course.
*/
public function test_completion() {
global $PAGE;
$this->setAdminUser();
$manager1 = new course_enrolment_manager($PAGE, $this->course1);
$this->assertCount(0, $manager1->get_user_enrolments($this->student->id));
$completionauto = ['completion' => COMPLETION_TRACKING_AUTOMATIC];
$ccompletion = new completion_completion(['course' => $this->course2->id, 'userid' => $this->student->id]);
$sink = $this->redirectEvents();
$ccompletion->mark_complete();
$this->assertCount(1, $sink->get_events());
$sink->close();
// TODO: Why is this user not enrolled?
$this->assertCount(0, $manager1->get_user_enrolments($this->student->id));
}

/**
* Test ue.
*/
Expand Down

0 comments on commit 86f496d

Please sign in to comment.