MDL-48012 core: fixed failing unit tests
authorMark Nelson <markn@moodle.com>
Wed, 24 Feb 2016 10:23:34 +0000 (18:23 +0800)
committerMark Nelson <markn@moodle.com>
Tue, 15 Mar 2016 08:58:47 +0000 (16:58 +0800)
admin/tool/recyclebin/classes/course.php
lib/tests/event_grade_deleted_test.php

index ef83d17..17c9cf0 100644 (file)
@@ -92,6 +92,11 @@ class course extends recyclebin
 
         // Get more information.
         $modinfo = get_fast_modinfo($cm->course);
+
+        if (!isset($modinfo->cms[$cm->id])) {
+            return; // Can't continue without the module information.
+        }
+
         $cminfo = $modinfo->cms[$cm->id];
 
         // Check backup/restore support.
index 77f3a21..3f5328b 100644 (file)
@@ -69,7 +69,7 @@ class core_event_grade_deleted_testcase extends advanced_testcase {
         $sink = $this->redirectEvents();
         course_delete_module($quiz->cmid);
         $events = $sink->get_events();
-        $event = reset($events);
+        $event = $events[1];
         $sink->close();
 
         // Check the event details are correct.