Commit b5469639 authored by Rajesh Taneja's avatar Rajesh Taneja
Browse files

MDL-44552 Events: Fixed wrong id returned in get_url

parent c0e88129
......@@ -39,7 +39,7 @@ class comment_created extends \core\event\comment_created {
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/data/view.php', array('id' => $this->other['itemid']));
return new \moodle_url('/mod/data/view.php', array('id' => $this->contextinstanceid));
}
/**
......
......@@ -39,7 +39,7 @@ class comment_deleted extends \core\event\comment_deleted {
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/data/view.php', array('id' => $this->other['itemid']));
return new \moodle_url('/mod/data/view.php', array('id' => $this->contextinstanceid));
}
/**
......
......@@ -163,7 +163,7 @@ class data_lib_testcase extends advanced_testcase {
// Checking that the event contains the expected values.
$this->assertInstanceOf('\mod_data\event\comment_created', $event);
$this->assertEquals($context, $event->get_context());
$url = new moodle_url('/mod/data/view.php', array('id' => $module->id));
$url = new moodle_url('/mod/data/view.php', array('id' => $module->cmid));
$this->assertEquals($url, $event->get_url());
$this->assertEventContextNotUsed($event);
}
......@@ -227,7 +227,7 @@ class data_lib_testcase extends advanced_testcase {
// Checking that the event contains the expected values.
$this->assertInstanceOf('\mod_data\event\comment_deleted', $event);
$this->assertEquals($context, $event->get_context());
$url = new moodle_url('/mod/data/view.php', array('id' => $module->id));
$url = new moodle_url('/mod/data/view.php', array('id' => $module->cmid));
$this->assertEquals($url, $event->get_url());
$this->assertEventContextNotUsed($event);
}
......
......@@ -39,7 +39,7 @@ class comment_created extends \core\event\comment_created {
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/glossary/view.php', array('id' => $this->other['itemid']));
return new \moodle_url('/mod/glossary/view.php', array('id' => $this->contextinstanceid));
}
/**
......
......@@ -39,7 +39,7 @@ class comment_deleted extends \core\event\comment_deleted {
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/mod/glossary/view.php', array('id' => $this->other['itemid']));
return new \moodle_url('/mod/glossary/view.php', array('id' => $this->contextinstanceid));
}
/**
......
......@@ -39,7 +39,7 @@ class glossary_event_testcase extends advanced_testcase {
* Test comment_created event.
*/
public function test_comment_created() {
global $CFG, $DB;
global $CFG;
require_once($CFG->dirroot . '/comment/lib.php');
$this->resetAfterTest();
......@@ -74,7 +74,7 @@ class glossary_event_testcase extends advanced_testcase {
// Checking that the event contains the expected values.
$this->assertInstanceOf('\mod_glossary\event\comment_created', $event);
$this->assertEquals($context, $event->get_context());
$url = new moodle_url('/mod/glossary/view.php', array('id' => $glossary->id));
$url = new moodle_url('/mod/glossary/view.php', array('id' => $glossary->cmid));
$this->assertEquals($url, $event->get_url());
$this->assertEventContextNotUsed($event);
}
......@@ -83,7 +83,7 @@ class glossary_event_testcase extends advanced_testcase {
* Test comment_deleted event.
*/
public function test_comment_deleted() {
global $CFG, $DB;
global $CFG;
require_once($CFG->dirroot . '/comment/lib.php');
$this->resetAfterTest();
......@@ -119,7 +119,7 @@ class glossary_event_testcase extends advanced_testcase {
// Checking that the event contains the expected values.
$this->assertInstanceOf('\mod_glossary\event\comment_deleted', $event);
$this->assertEquals($context, $event->get_context());
$url = new moodle_url('/mod/glossary/view.php', array('id' => $glossary->id));
$url = new moodle_url('/mod/glossary/view.php', array('id' => $glossary->cmid));
$this->assertEquals($url, $event->get_url());
$this->assertEventContextNotUsed($event);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment