diff --git a/mod/data/classes/event/comment_created.php b/mod/data/classes/event/comment_created.php index 9bf3c63af8e..85868148605 100644 --- a/mod/data/classes/event/comment_created.php +++ b/mod/data/classes/event/comment_created.php @@ -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)); } /** diff --git a/mod/data/classes/event/comment_deleted.php b/mod/data/classes/event/comment_deleted.php index b73d6a07bc0..9509b416191 100644 --- a/mod/data/classes/event/comment_deleted.php +++ b/mod/data/classes/event/comment_deleted.php @@ -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)); } /** diff --git a/mod/data/tests/lib_test.php b/mod/data/tests/lib_test.php index 1d757c2a2fb..2de1fcd4eac 100644 --- a/mod/data/tests/lib_test.php +++ b/mod/data/tests/lib_test.php @@ -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); } diff --git a/mod/glossary/classes/event/comment_created.php b/mod/glossary/classes/event/comment_created.php index bdae5489bd0..c81cabfb254 100644 --- a/mod/glossary/classes/event/comment_created.php +++ b/mod/glossary/classes/event/comment_created.php @@ -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)); } /** diff --git a/mod/glossary/classes/event/comment_deleted.php b/mod/glossary/classes/event/comment_deleted.php index a864bfebe6f..4a6d59fef8b 100644 --- a/mod/glossary/classes/event/comment_deleted.php +++ b/mod/glossary/classes/event/comment_deleted.php @@ -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)); } /** diff --git a/mod/glossary/tests/events_test.php b/mod/glossary/tests/events_test.php index 33052043fb0..95a51b3658c 100644 --- a/mod/glossary/tests/events_test.php +++ b/mod/glossary/tests/events_test.php @@ -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); }