mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-44552 Events: Fixed wrong id returned in get_url
This commit is contained in:
parent
c0e88129d1
commit
b54696395d
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user