Permalink
Browse files

MDL-37476 course_create unit test fails if course completion is enabled

  • Loading branch information...
mouneyrac committed Jan 23, 2013
1 parent e61f96c commit 30e2ad8b853ea58052a5d6cdb0db2fde398b9a94
Showing with 5 additions and 7 deletions.
  1. +5 −7 course/tests/externallib_test.php
@@ -322,6 +322,9 @@ public function test_create_courses() {
$this->resetAfterTest(true);
+ // Enable course completion.
+ set_config('enablecompletion', 1);
+
// Set the required capabilities by the external function
$contextid = context_system::instance()->id;
$roleid = $this->assignUserCapability('moodle/course:create', $contextid);
@@ -396,13 +399,8 @@ public function test_create_courses() {
$this->assertEquals($dbcourse->theme, $course2['forcetheme']);
}
- if (completion_info::is_enabled_for_site()) {
- $this->assertEquals($dbcourse->enablecompletion, $course2['enabledcompletion']);
- $this->assertEquals($dbcourse->completionstartonenrol, $course2['completionstartonenrol']);
- } else {
- $this->assertEquals($dbcourse->enablecompletion, 0);
- $this->assertEquals($dbcourse->completionstartonenrol, 0);
- }
+ $this->assertEquals($dbcourse->enablecompletion, $course2['enablecompletion']);
+ $this->assertEquals($dbcourse->completionstartonenrol, $course2['completionstartonenrol']);
} else if ($createdcourse['shortname'] == $course1['shortname']) {
$courseconfig = get_config('moodlecourse');

0 comments on commit 30e2ad8

Please sign in to comment.