MDL-37028 fixed course-module generation
authorMarina Glancy <marina@moodle.com>
Tue, 10 Sep 2013 10:03:54 +0000 (20:03 +1000)
committerDamyon Wiese <damyon@moodle.com>
Wed, 11 Sep 2013 02:47:49 +0000 (10:47 +0800)
still conditionlib should be using API functions and not inserting the data directly in DB but will fix in another issue

lib/tests/conditionlib_test.php

index 63cb202..3c9c761 100644 (file)
@@ -218,6 +218,9 @@ class core_conditionlib_testcase extends advanced_testcase {
             $record->{$name} = $value;
         }
         $sectionid = $DB->insert_record('course_sections', $record);
+        foreach ($cmids as $cmid) {
+            $DB->update_record('course_modules', array('section' => $sectionid, 'id' => $cmid));
+        }
         rebuild_course_cache($courseid, true);
         return $sectionid;
     }