MDL-44272 events: Fix incorrect urls in course module events

This commit is contained in:
Ankit Agarwal 2014-02-24 15:08:22 +08:00
parent 692d247a3a
commit df9a6c0114
3 changed files with 8 additions and 8 deletions

View File

@ -1945,7 +1945,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this->assertEquals($cm->id, $event->objectid);
$this->assertEquals($USER->id, $event->userid);
$this->assertEquals('course_modules', $event->objecttable);
$url = new moodle_url('/mod/assign/view.php', array('id' => $mod->id));
$url = new moodle_url('/mod/assign/view.php', array('id' => $cm->id));
$this->assertEquals($url, $event->get_url());
// Test legacy data.
@ -1958,7 +1958,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$eventdata->userid = $USER->id;
$this->assertEventLegacyData($eventdata, $event);
$arr = array($cm->course, "course", "add mod", "../mod/assign/view.php?id=$mod->id", "assign $cm->instance");
$arr = array($cm->course, "course", "add mod", "../mod/assign/view.php?id=$cm->id", "assign $cm->instance");
$this->assertEventLegacyLogData($arr, $event);
$this->assertEventContextNotUsed($event);
@ -2051,7 +2051,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this->assertEquals($cm->id, $event->objectid);
$this->assertEquals($USER->id, $event->userid);
$this->assertEquals('course_modules', $event->objecttable);
$url = new moodle_url('/mod/forum/view.php', array('id' => $mod->id));
$url = new moodle_url('/mod/forum/view.php', array('id' => $cm->id));
$this->assertEquals($url, $event->get_url());
// Test legacy data.
@ -2064,7 +2064,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$eventdata->userid = $USER->id;
$this->assertEventLegacyData($eventdata, $event);
$arr = array($cm->course, "course", "update mod", "../mod/forum/view.php?id=$mod->id", "forum $cm->instance");
$arr = array($cm->course, "course", "update mod", "../mod/forum/view.php?id=$cm->id", "forum $cm->instance");
$this->assertEventLegacyLogData($arr, $event);
$this->assertEventContextNotUsed($event);
}

View File

@ -77,7 +77,7 @@ class course_module_created extends base {
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/' . $this->other['modulename'] . '/view.php', array('id' => $this->other['instanceid']));
return new \moodle_url('/mod/' . $this->other['modulename'] . '/view.php', array('id' => $this->objectid));
}
/**
@ -111,7 +111,7 @@ class course_module_created extends base {
*/
protected function get_legacy_logdata() {
return array ($this->courseid, "course", "add mod", "../mod/" . $this->other['modulename'] . "/view.php?id=" .
$this->other['instanceid'], $this->other['modulename'] . " " . $this->other['instanceid']);
$this->objectid, $this->other['modulename'] . " " . $this->other['instanceid']);
}
/**

View File

@ -77,7 +77,7 @@ class course_module_updated extends base {
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/' . $this->other['modulename'] . '/view.php', array('id' => $this->other['instanceid']));
return new \moodle_url('/mod/' . $this->other['modulename'] . '/view.php', array('id' => $this->objectid));
}
/**
@ -111,7 +111,7 @@ class course_module_updated extends base {
*/
protected function get_legacy_logdata() {
return array ($this->courseid, "course", "update mod", "../mod/" . $this->other['modulename'] . "/view.php?id=" .
$this->other['instanceid'], $this->other['modulename'] . " " . $this->other['instanceid']);
$this->objectid, $this->other['modulename'] . " " . $this->other['instanceid']);
}
/**