MDL-42557 Events: added idnumber to course_deleted event data
authorRajesh Taneja <rajesh@moodle.com>
Mon, 28 Oct 2013 08:16:25 +0000 (16:16 +0800)
committerRajesh Taneja <rajesh@moodle.com>
Mon, 28 Oct 2013 08:16:25 +0000 (16:16 +0800)
course/tests/courselib_test.php
lib/moodlelib.php

index b28522e..1935ec7 100644 (file)
@@ -1534,6 +1534,10 @@ class core_course_courselib_testcase extends advanced_testcase {
         $this->assertEquals($coursecontext->id, $event->contextid);
         $this->assertEquals($course, $event->get_record_snapshot('course', $course->id));
         $this->assertEquals('course_deleted', $event->get_legacy_eventname());
+        $eventdata = $event->get_data();
+        $this->assertSame($course->idnumber, $eventdata['other']['idnumber']);
+        $this->assertSame($course->fullname, $eventdata['other']['fullname']);
+        $this->assertSame($course->shortname, $eventdata['other']['shortname']);
         // The legacy data also passed the context in the course object.
         $course->context = $coursecontext;
         $this->assertEventLegacyData($course, $event);
index 83d95db..f9efd0a 100644 (file)
@@ -4849,8 +4849,11 @@ function delete_course($courseorid, $showfeedback = true) {
     $event = \core\event\course_deleted::create(array(
         'objectid' => $course->id,
         'context' => $context,
-        'other' => array('shortname' => $course->shortname,
-                         'fullname' => $course->fullname)
+        'other' => array(
+            'shortname' => $course->shortname,
+            'fullname' => $course->fullname,
+            'idnumber' => $course->idnumber
+            )
     ));
     $event->add_record_snapshot('course', $course);
     $event->trigger();