MDL-39957 course: added missing assertions for events
authorMark Nelson <markn@moodle.com>
Tue, 20 Aug 2013 07:42:12 +0000 (15:42 +0800)
committerDan Poltawski <dan@moodle.com>
Tue, 20 Aug 2013 07:59:11 +0000 (15:59 +0800)
This occurred when an add_to_log call, with no associated legacy event,
was replaced with a new event. We should still call assertEventLegacyData
even though there is no legacy event data to compare with, simply ensure
that the expected data was passed.

course/tests/courselib_test.php

index e780e19..01c4bfc 100644 (file)
@@ -1425,6 +1425,7 @@ class core_course_courselib_testcase extends advanced_testcase {
         $this->assertEquals(context_course::instance($movedcourse->id)->id, $event->contextid);
         $this->assertEquals($movedcourse, $event->get_record_snapshot('course', $movedcourse->id));
         $this->assertEquals('course_updated', $event->get_legacy_eventname());
+        $this->assertEventLegacyData($movedcourse, $event);
         $expectedlog = array($movedcourse->id, 'course', 'move', 'edit.php?id=' . $movedcourse->id, $movedcourse->id);
         $this->assertEventLegacyLogData($expectedlog, $event);
     }
@@ -1573,6 +1574,7 @@ class core_course_courselib_testcase extends advanced_testcase {
         $this->assertEquals($category2->id, $event->objectid);
         $this->assertEquals($category2context->id, $event->contextid);
         $this->assertEquals('course_category_deleted', $event->get_legacy_eventname());
+        $this->assertEventLegacyData($category2, $event);
         $expectedlog = array(SITEID, 'category', 'delete', 'index.php', $category2->name . '(ID ' . $category2->id . ')');
         $this->assertEventLegacyLogData($expectedlog, $event);
     }