Permalink
Browse files

Merge branch 'MDL-62364_master' of git://github.com/markn86/moodle

  • Loading branch information...
dmonllao authored and junpataleta committed May 9, 2018
2 parents 6fe7510 + b6b7c26 commit a49a43853672b729ca1c9baa1e9a763f12b33172
Showing with 22 additions and 0 deletions.
  1. +5 −0 lib/classes/event/notification_sent.php
  2. +17 −0 message/tests/events_test.php
@@ -58,6 +58,11 @@ public static function create_from_ids($userfromid, $usertoid, $notificationid,
$userfromid = 0;
}
// If the courseid is null, then set it to the site id.
if (is_null($courseid)) {
$courseid = SITEID;
}
$event = self::create(
[
'objectid' => $notificationid,
@@ -484,6 +484,23 @@ public function test_notification_sent() {
$this->assertEquals($url, $event->get_url());
}
/**
* Test the notification sent event when null passed as course.
*/
public function test_notification_sent_with_null_course() {
$event = \core\event\notification_sent::create_from_ids(1, 1, 1, null);
// Trigger and capture the event.
$sink = $this->redirectEvents();
$event->trigger();
$events = $sink->get_events();
$event = reset($events);
// Check that the event data is valid.
$this->assertInstanceOf('\core\event\notification_sent', $event);
$this->assertEquals(SITEID, $event->other['courseid']);
}
/**
* Test the notification viewed event.
*/

0 comments on commit a49a438

Please sign in to comment.