See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Base trait for message popup tests. 19 * 20 * @package message_popup 21 * @copyright 2016 Ryan Wyllie <ryan@moodle.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die(); 26 27 use \core_message\tests\helper as testhelper; 28 29 trait message_popup_test_helper { 30 31 /** 32 * Send a fake unread popup notification. 33 * 34 * {@link message_send()} does not support transaction, this function will simulate a message 35 * sent from a user to another. We should stop using it once {@link message_send()} will support 36 * transactions. This is not clean at all, this is just used to add rows to the table. 37 * 38 * @param stdClass $userfrom user object of the one sending the message. 39 * @param stdClass $userto user object of the one receiving the message. 40 * @param string $message message to send. 41 * @param int $timecreated time the message was created. 42 * @return int the id of the message 43 */ 44 protected function send_fake_unread_popup_notification(\stdClass $userfrom, \stdClass $userto, 45 string $message = 'Hello world!', int $timecreated = 0): int { 46 global $DB; 47 48 $id = testhelper::send_fake_unread_notification($userfrom, $userto, $message, $timecreated); 49 50 $popup = new stdClass(); 51 $popup->notificationid = $id; 52 53 $DB->insert_record('message_popup_notifications', $popup); 54 55 return $id; 56 } 57 58 /** 59 * Send a fake read popup notification. 60 * 61 * {@link message_send()} does not support transaction, this function will simulate a message 62 * sent from a user to another. We should stop using it once {@link message_send()} will support 63 * transactions. This is not clean at all, this is just used to add rows to the table. 64 * 65 * @param stdClass $userfrom user object of the one sending the message. 66 * @param stdClass $userto user object of the one receiving the message. 67 * @param string $message message to send. 68 * @param int $timecreated time the message was created. 69 * @param int $timeread the the message was read 70 * @return int the id of the message 71 */ 72 protected function send_fake_read_popup_notification(\stdClass $userfrom, \stdClass $userto, string $message = 'Hello world!', 73 int $timecreated = 0, int $timeread = 0): int { 74 global $DB; 75 76 $id = testhelper::send_fake_read_notification($userfrom, $userto, $message, $timecreated, $timeread); 77 78 $popup = new stdClass(); 79 $popup->notificationid = $id; 80 $DB->insert_record('message_popup_notifications', $popup); 81 82 return $id; 83 } 84 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body