Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'MDL-37476-stable24' of git://github.com/mouneyrac/moodl…

…e into MOODLE_24_STABLE
  • Loading branch information...
commit 3cb032512246b9ffe5d27a5c78fa7fdac5510053 2 parents 2a97de2 + 7e21841
Sam Hemelryk authored January 29, 2013

Showing 1 changed file with 8 additions and 9 deletions. Show diff stats Hide diff stats

  1. 17  course/tests/externallib_test.php
17  course/tests/externallib_test.php
@@ -322,6 +322,9 @@ public function test_create_courses() {
322 322
 
323 323
         $this->resetAfterTest(true);
324 324
 
  325
+        // Enable course completion.
  326
+        set_config('enablecompletion', 1);
  327
+
325 328
         // Set the required capabilities by the external function
326 329
         $contextid = context_system::instance()->id;
327 330
         $roleid = $this->assignUserCapability('moodle/course:create', $contextid);
@@ -367,7 +370,7 @@ public function test_create_courses() {
367 370
         foreach ($course3options as $key => $value) {
368 371
             $course3['courseformatoptions'][] = array('name' => $key, 'value' => $value);
369 372
         }
370  
-        $courses = array($course1, $course2);
  373
+        $courses = array($course1, $course2, $course3);
371 374
 
372 375
         $createdcourses = core_course_external::create_courses($courses);
373 376
 
@@ -375,7 +378,7 @@ public function test_create_courses() {
375 378
         $createdcourses = external_api::clean_returnvalue(core_course_external::create_courses_returns(), $createdcourses);
376 379
 
377 380
         // Check that right number of courses were created.
378  
-        $this->assertEquals(2, count($createdcourses));
  381
+        $this->assertEquals(3, count($createdcourses));
379 382
 
380 383
         // Check that the courses were correctly created.
381 384
         foreach ($createdcourses as $createdcourse) {
@@ -407,13 +410,9 @@ public function test_create_courses() {
407 410
                     $this->assertEquals($courseinfo->theme, $course2['forcetheme']);
408 411
                 }
409 412
 
410  
-                if (completion_info::is_enabled_for_site()) {
411  
-                    $this->assertEquals($courseinfo->enablecompletion, $course2['enabledcompletion']);
412  
-                    $this->assertEquals($courseinfo->completionstartonenrol, $course2['completionstartonenrol']);
413  
-                } else {
414  
-                    $this->assertEquals($courseinfo->enablecompletion, 0);
415  
-                    $this->assertEquals($courseinfo->completionstartonenrol, 0);
416  
-                }
  413
+                // We enabled completion at the beginning of the test.
  414
+                $this->assertEquals($courseinfo->enablecompletion, $course2['enablecompletion']);
  415
+                $this->assertEquals($courseinfo->completionstartonenrol, $course2['completionstartonenrol']);
417 416
 
418 417
             } else if ($createdcourse['shortname'] == $course1['shortname']) {
419 418
                 $courseconfig = get_config('moodlecourse');

0 notes on commit 3cb0325

Please sign in to comment.
Something went wrong with that request. Please try again.