Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge branch 'MDL-62364_master' of git://github.com/markn86/moodle
- Loading branch information
Showing
with
22 additions
and
0 deletions.
-
+5
−0
lib/classes/event/notification_sent.php
-
+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. |
|
|
*/ |
|
|