diff --git a/notifications/tests/MockedNotifications.php b/notifications/tests/MockedNotifications.php new file mode 100644 index 0000000000..dcd71661ad --- /dev/null +++ b/notifications/tests/MockedNotifications.php @@ -0,0 +1,45 @@ + + * $callback = function() use ($expected) { + * $test->assertContains($expected,$this->message_plain); + * }; + * MockedNotifications::set_callback($callback); + * $this->bo->tracking = new \_tracking($this->bo, MockedNotifications::class); + * + * + * Everything will run as normal except notifications won't be sent, and you can + * put assertions into the callback for what you expect of the notification(s). + */ +class MockedNotifications extends \notifications +{ + static $send_callback; + public static function set_callback(\Closure $send) + { + static::$send_callback = $send; + } + public function send() + { + return static::$send_callback->call($this); + } +} \ No newline at end of file