1 |
efrain |
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 |
* Tests for the invitation class.
|
|
|
19 |
*
|
|
|
20 |
* @package mod_zoom
|
|
|
21 |
* @author Andrew Madden <andrewmadden@catalyst-au.net>
|
|
|
22 |
* @copyright 2021 Catalyst IT
|
|
|
23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
24 |
*/
|
|
|
25 |
|
|
|
26 |
namespace mod_zoom;
|
|
|
27 |
|
|
|
28 |
use advanced_testcase;
|
|
|
29 |
use context_system;
|
|
|
30 |
use context_course;
|
|
|
31 |
use moodle_url;
|
|
|
32 |
|
|
|
33 |
/**
|
|
|
34 |
* PHPunit testcase class for invitations.
|
|
|
35 |
* @covers \mod_zoom\invitation
|
|
|
36 |
*/
|
|
|
37 |
final class mod_zoom_invitation_test extends advanced_testcase {
|
|
|
38 |
/**
|
|
|
39 |
* Setup to ensure that fixtures are loaded.
|
|
|
40 |
*/
|
|
|
41 |
public static function setUpBeforeClass(): void {
|
|
|
42 |
global $CFG;
|
|
|
43 |
require_once($CFG->libdir . '/accesslib.php');
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
/**
|
|
|
47 |
* Run before every test.
|
|
|
48 |
*/
|
|
|
49 |
protected function setUp(): void {
|
|
|
50 |
set_config('invitationregexenabled', 1, 'zoom');
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
/**
|
|
|
54 |
* Test zoom invitation display message for user with all capabilities.
|
|
|
55 |
*/
|
|
|
56 |
public function test_display_message_when_user_has_all_capabilities(): void {
|
|
|
57 |
$this->resetAfterTest();
|
|
|
58 |
$this->setAdminUser();
|
|
|
59 |
$course = $this->getDataGenerator()->create_course();
|
|
|
60 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
61 |
$message = (new invitation(
|
|
|
62 |
$this->get_mock_invitation_message_scheduledmeeting()
|
|
|
63 |
))->get_display_string($zoom->cmid);
|
|
|
64 |
$expectedmessage = "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
65 |
. "\r\n"
|
|
|
66 |
. "Topic: Zoom Meeting\r\n"
|
|
|
67 |
. "Time: Mar 15, 2021 06:08 AM London\r\n"
|
|
|
68 |
. "\r\n"
|
|
|
69 |
. "Join Zoom Meeting\r\n"
|
|
|
70 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
71 |
. "\r\n"
|
|
|
72 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
73 |
. "Passcode: 123123\r\n"
|
|
|
74 |
. "\r\n"
|
|
|
75 |
. "One tap mobile\r\n"
|
|
|
76 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
77 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
78 |
. "\r\n"
|
|
|
79 |
. "Dial by your location\r\n"
|
|
|
80 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
81 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
82 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
83 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
84 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
85 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
86 |
. "Passcode: 123456\r\n"
|
|
|
87 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
88 |
. "\r\n"
|
|
|
89 |
. "Join by SIP\r\n"
|
|
|
90 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
91 |
. "\r\n"
|
|
|
92 |
. "Join by H.323\r\n"
|
|
|
93 |
. "162.255.37.11 (US West)\r\n"
|
|
|
94 |
. "162.255.36.11 (US East)\r\n"
|
|
|
95 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
96 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
97 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
98 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
99 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
100 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
101 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
102 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
103 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
104 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
105 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
106 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
107 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
108 |
. "Passcode: 44730043";
|
|
|
109 |
$this->assertEquals($expectedmessage, $message);
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
/**
|
|
|
113 |
* Test zoom invitation display message for user with only the mod/zoom:viewjoinurl capability.
|
|
|
114 |
*/
|
|
|
115 |
public function test_display_message_when_user_has_viewjoinurl_capability(): void {
|
|
|
116 |
$this->resetAfterTest();
|
|
|
117 |
$this->setAdminUser();
|
|
|
118 |
$user = $this->getDataGenerator()->create_user();
|
|
|
119 |
$course = $this->getDataGenerator()->create_course();
|
|
|
120 |
$role = $this->getDataGenerator()->create_role();
|
|
|
121 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
122 |
assign_capability('mod/zoom:viewjoinurl', CAP_ALLOW, $role, context_system::instance()->id);
|
|
|
123 |
role_assign($role, $user->id, context_course::instance($course->id));
|
|
|
124 |
$message = (new invitation(
|
|
|
125 |
$this->get_mock_invitation_message_scheduledmeeting()
|
|
|
126 |
))->get_display_string($zoom->cmid, $user->id);
|
|
|
127 |
$expectedmessage = "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
128 |
. "\r\n"
|
|
|
129 |
. "Topic: Zoom Meeting\r\n"
|
|
|
130 |
. "Time: Mar 15, 2021 06:08 AM London\r\n"
|
|
|
131 |
. "\r\n"
|
|
|
132 |
. "Join Zoom Meeting\r\n"
|
|
|
133 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
134 |
. "\r\n"
|
|
|
135 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
136 |
. "Passcode: 123123";
|
|
|
137 |
$this->assertEquals($expectedmessage, $message);
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
/**
|
|
|
141 |
* Test zoom invitation display message for user with only the mod/zoom:viewdialin capability.
|
|
|
142 |
*/
|
|
|
143 |
public function test_display_message_when_user_has_viewdialin_capability(): void {
|
|
|
144 |
$this->resetAfterTest();
|
|
|
145 |
$this->setAdminUser();
|
|
|
146 |
$user = $this->getDataGenerator()->create_user();
|
|
|
147 |
$course = $this->getDataGenerator()->create_course();
|
|
|
148 |
$role = $this->getDataGenerator()->create_role();
|
|
|
149 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
150 |
assign_capability('mod/zoom:viewdialin', CAP_ALLOW, $role, context_system::instance());
|
|
|
151 |
role_assign($role, $user->id, context_course::instance($course->id));
|
|
|
152 |
$message = (new invitation(
|
|
|
153 |
$this->get_mock_invitation_message_scheduledmeeting()
|
|
|
154 |
))->get_display_string($zoom->cmid, $user->id);
|
|
|
155 |
$expectedmessage = "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
156 |
. "\r\n"
|
|
|
157 |
. "Topic: Zoom Meeting\r\n"
|
|
|
158 |
. "Time: Mar 15, 2021 06:08 AM London\r\n"
|
|
|
159 |
. "\r\n"
|
|
|
160 |
. "One tap mobile\r\n"
|
|
|
161 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
162 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
163 |
. "\r\n"
|
|
|
164 |
. "Dial by your location\r\n"
|
|
|
165 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
166 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
167 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
168 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
169 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
170 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
171 |
. "Passcode: 123456\r\n"
|
|
|
172 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
173 |
. "\r\n"
|
|
|
174 |
. "Join by SIP\r\n"
|
|
|
175 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
176 |
. "\r\n"
|
|
|
177 |
. "Join by H.323\r\n"
|
|
|
178 |
. "162.255.37.11 (US West)\r\n"
|
|
|
179 |
. "162.255.36.11 (US East)\r\n"
|
|
|
180 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
181 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
182 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
183 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
184 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
185 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
186 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
187 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
188 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
189 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
190 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
191 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
192 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
193 |
. "Passcode: 44730043";
|
|
|
194 |
$this->assertEquals($expectedmessage, $message);
|
|
|
195 |
}
|
|
|
196 |
|
|
|
197 |
/**
|
|
|
198 |
* Test zoom invitation display message for user has no capabilities.
|
|
|
199 |
*/
|
|
|
200 |
public function test_display_message_when_user_has_no_capabilities(): void {
|
|
|
201 |
$this->resetAfterTest();
|
|
|
202 |
$this->setAdminUser();
|
|
|
203 |
$user = $this->getDataGenerator()->create_user();
|
|
|
204 |
$course = $this->getDataGenerator()->create_course();
|
|
|
205 |
$role = $this->getDataGenerator()->create_role();
|
|
|
206 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
207 |
role_assign($role, $user->id, context_course::instance($course->id));
|
|
|
208 |
$message = (new invitation(
|
|
|
209 |
$this->get_mock_invitation_message_scheduledmeeting()
|
|
|
210 |
))->get_display_string($zoom->cmid, $user->id);
|
|
|
211 |
$expectedmessage = "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
212 |
. "\r\n"
|
|
|
213 |
. "Topic: Zoom Meeting\r\n"
|
|
|
214 |
. "Time: Mar 15, 2021 06:08 AM London";
|
|
|
215 |
$this->assertEquals($expectedmessage, $message);
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
/**
|
|
|
219 |
* Test message if regex pattern is intentionally set to empty for an element.
|
|
|
220 |
*/
|
|
|
221 |
public function test_display_message_when_a_regex_pattern_is_empty(): void {
|
|
|
222 |
global $PAGE;
|
|
|
223 |
$this->resetAfterTest();
|
|
|
224 |
$this->setAdminUser();
|
|
|
225 |
set_config('invitation_joinurl', '', 'zoom');
|
|
|
226 |
$user = $this->getDataGenerator()->create_user();
|
|
|
227 |
$course = $this->getDataGenerator()->create_course();
|
|
|
228 |
$role = $this->getDataGenerator()->create_role();
|
|
|
229 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
230 |
role_assign($role, $user->id, context_course::instance($course->id));
|
|
|
231 |
// Set mock zoom activity URL for page as exception messages expect it.
|
|
|
232 |
$PAGE->set_url(new moodle_url('/mod/zoom/view.php?id=123'));
|
|
|
233 |
$message = (new invitation(
|
|
|
234 |
$this->get_mock_invitation_message_scheduledmeeting()
|
|
|
235 |
))->get_display_string($zoom->cmid, $user->id);
|
|
|
236 |
$this->assertDebuggingNotCalled();
|
|
|
237 |
}
|
|
|
238 |
|
|
|
239 |
/**
|
|
|
240 |
* Test debug message if regex pattern is not valid for an element.
|
|
|
241 |
*/
|
|
|
242 |
public function test_display_message_when_a_regex_pattern_is_invalid(): void {
|
|
|
243 |
global $PAGE;
|
|
|
244 |
$this->resetAfterTest();
|
|
|
245 |
$this->setAdminUser();
|
|
|
246 |
set_config('invitation_joinurl', '~', 'zoom');
|
|
|
247 |
$user = $this->getDataGenerator()->create_user();
|
|
|
248 |
$course = $this->getDataGenerator()->create_course();
|
|
|
249 |
$role = $this->getDataGenerator()->create_role();
|
|
|
250 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
251 |
role_assign($role, $user->id, context_course::instance($course->id));
|
|
|
252 |
// Set mock zoom activity URL for page as exception messages expect it.
|
|
|
253 |
$PAGE->set_url(new moodle_url('/mod/zoom/view.php?id=123'));
|
|
|
254 |
$message = (new invitation(
|
|
|
255 |
$this->get_mock_invitation_message_scheduledmeeting()
|
|
|
256 |
))->get_display_string($zoom->cmid, $user->id);
|
|
|
257 |
$this->assertDebuggingCalled('Error in regex for zoom invitation element: "joinurl" with pattern: "~".');
|
|
|
258 |
}
|
|
|
259 |
|
|
|
260 |
/**
|
|
|
261 |
* Test debug message if no match is found using regex pattern for an element.
|
|
|
262 |
*/
|
|
|
263 |
public function test_display_message_when_a_regex_pattern_is_finds_no_match(): void {
|
|
|
264 |
$this->resetAfterTest();
|
|
|
265 |
$this->setAdminUser();
|
|
|
266 |
set_config('invitation_joinurl', '/nomatch/mi', 'zoom');
|
|
|
267 |
$user = $this->getDataGenerator()->create_user();
|
|
|
268 |
$course = $this->getDataGenerator()->create_course();
|
|
|
269 |
$role = $this->getDataGenerator()->create_role();
|
|
|
270 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
271 |
role_assign($role, $user->id, context_course::instance($course->id));
|
|
|
272 |
$message = (new invitation(
|
|
|
273 |
$this->get_mock_invitation_message_scheduledmeeting()
|
|
|
274 |
))->get_display_string($zoom->cmid, $user->id);
|
|
|
275 |
$this->assertDebuggingCalled('No match found in zoom invitation for element: "joinurl" with pattern: "/nomatch/mi".');
|
|
|
276 |
}
|
|
|
277 |
|
|
|
278 |
/**
|
|
|
279 |
* Test removing the invite sentence from the zoom meeting message.
|
|
|
280 |
*/
|
|
|
281 |
public function test_display_message_has_invite_removed_if_setting_enabled(): void {
|
|
|
282 |
$this->resetAfterTest();
|
|
|
283 |
$this->setAdminUser();
|
|
|
284 |
set_config('invitationremoveinvite', '1', 'zoom');
|
|
|
285 |
$course = $this->getDataGenerator()->create_course();
|
|
|
286 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
287 |
$message = (new invitation(
|
|
|
288 |
$this->get_mock_invitation_message_scheduledmeeting()
|
|
|
289 |
))->get_display_string($zoom->cmid);
|
|
|
290 |
$expectedmessage = "Topic: Zoom Meeting\r\n"
|
|
|
291 |
. "Time: Mar 15, 2021 06:08 AM London\r\n"
|
|
|
292 |
. "\r\n"
|
|
|
293 |
. "Join Zoom Meeting\r\n"
|
|
|
294 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
295 |
. "\r\n"
|
|
|
296 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
297 |
. "Passcode: 123123\r\n"
|
|
|
298 |
. "\r\n"
|
|
|
299 |
. "One tap mobile\r\n"
|
|
|
300 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
301 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
302 |
. "\r\n"
|
|
|
303 |
. "Dial by your location\r\n"
|
|
|
304 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
305 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
306 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
307 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
308 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
309 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
310 |
. "Passcode: 123456\r\n"
|
|
|
311 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
312 |
. "\r\n"
|
|
|
313 |
. "Join by SIP\r\n"
|
|
|
314 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
315 |
. "\r\n"
|
|
|
316 |
. "Join by H.323\r\n"
|
|
|
317 |
. "162.255.37.11 (US West)\r\n"
|
|
|
318 |
. "162.255.36.11 (US East)\r\n"
|
|
|
319 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
320 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
321 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
322 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
323 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
324 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
325 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
326 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
327 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
328 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
329 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
330 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
331 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
332 |
. "Passcode: 44730043";
|
|
|
333 |
$this->assertEquals($expectedmessage, $message);
|
|
|
334 |
}
|
|
|
335 |
|
|
|
336 |
/**
|
|
|
337 |
* Test not removing the invite sentence from the zoom meeting message.
|
|
|
338 |
*/
|
|
|
339 |
public function test_display_message_does_not_have_invite_removed_if_setting_disabled(): void {
|
|
|
340 |
$this->resetAfterTest();
|
|
|
341 |
$this->setAdminUser();
|
|
|
342 |
set_config('invitationremoveinvite', '0', 'zoom');
|
|
|
343 |
$course = $this->getDataGenerator()->create_course();
|
|
|
344 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
345 |
$message = (new invitation(
|
|
|
346 |
$this->get_mock_invitation_message_scheduledmeeting()
|
|
|
347 |
))->get_display_string($zoom->cmid);
|
|
|
348 |
$expectedmessage = "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
349 |
. "\r\n"
|
|
|
350 |
. "Topic: Zoom Meeting\r\n"
|
|
|
351 |
. "Time: Mar 15, 2021 06:08 AM London\r\n"
|
|
|
352 |
. "\r\n"
|
|
|
353 |
. "Join Zoom Meeting\r\n"
|
|
|
354 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
355 |
. "\r\n"
|
|
|
356 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
357 |
. "Passcode: 123123\r\n"
|
|
|
358 |
. "\r\n"
|
|
|
359 |
. "One tap mobile\r\n"
|
|
|
360 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
361 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
362 |
. "\r\n"
|
|
|
363 |
. "Dial by your location\r\n"
|
|
|
364 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
365 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
366 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
367 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
368 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
369 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
370 |
. "Passcode: 123456\r\n"
|
|
|
371 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
372 |
. "\r\n"
|
|
|
373 |
. "Join by SIP\r\n"
|
|
|
374 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
375 |
. "\r\n"
|
|
|
376 |
. "Join by H.323\r\n"
|
|
|
377 |
. "162.255.37.11 (US West)\r\n"
|
|
|
378 |
. "162.255.36.11 (US East)\r\n"
|
|
|
379 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
380 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
381 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
382 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
383 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
384 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
385 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
386 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
387 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
388 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
389 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
390 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
391 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
392 |
. "Passcode: 44730043";
|
|
|
393 |
$this->assertEquals($expectedmessage, $message);
|
|
|
394 |
}
|
|
|
395 |
|
|
|
396 |
/**
|
|
|
397 |
* Test removing the iCal link from the zoom meeting message.
|
|
|
398 |
*/
|
|
|
399 |
public function test_display_message_has_icallink_removed_if_setting_enabled(): void {
|
|
|
400 |
$this->resetAfterTest();
|
|
|
401 |
$this->setAdminUser();
|
|
|
402 |
set_config('invitationremoveicallink', '1', 'zoom');
|
|
|
403 |
$course = $this->getDataGenerator()->create_course();
|
|
|
404 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
405 |
|
|
|
406 |
// Test a scheduled meeting.
|
|
|
407 |
$message = (new invitation(
|
|
|
408 |
$this->get_mock_invitation_message_scheduledmeeting()
|
|
|
409 |
))->get_display_string($zoom->cmid);
|
|
|
410 |
$expectedmessage = "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
411 |
. "\r\n"
|
|
|
412 |
. "Topic: Zoom Meeting\r\n"
|
|
|
413 |
. "Time: Mar 15, 2021 06:08 AM London\r\n"
|
|
|
414 |
. "\r\n"
|
|
|
415 |
. "Join Zoom Meeting\r\n"
|
|
|
416 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
417 |
. "\r\n"
|
|
|
418 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
419 |
. "Passcode: 123123\r\n"
|
|
|
420 |
. "\r\n"
|
|
|
421 |
. "One tap mobile\r\n"
|
|
|
422 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
423 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
424 |
. "\r\n"
|
|
|
425 |
. "Dial by your location\r\n"
|
|
|
426 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
427 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
428 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
429 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
430 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
431 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
432 |
. "Passcode: 123456\r\n"
|
|
|
433 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
434 |
. "\r\n"
|
|
|
435 |
. "Join by SIP\r\n"
|
|
|
436 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
437 |
. "\r\n"
|
|
|
438 |
. "Join by H.323\r\n"
|
|
|
439 |
. "162.255.37.11 (US West)\r\n"
|
|
|
440 |
. "162.255.36.11 (US East)\r\n"
|
|
|
441 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
442 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
443 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
444 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
445 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
446 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
447 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
448 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
449 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
450 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
451 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
452 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
453 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
454 |
. "Passcode: 44730043";
|
|
|
455 |
$this->assertEquals($expectedmessage, $message);
|
|
|
456 |
|
|
|
457 |
// Test a recurring meeting with no fixed time.
|
|
|
458 |
$message = (new invitation(
|
|
|
459 |
$this->get_mock_invitation_message_recurringnofixed()
|
|
|
460 |
))->get_display_string($zoom->cmid);
|
|
|
461 |
$expectedmessage = "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
462 |
. "\r\n"
|
|
|
463 |
. "Topic: Zoom Meeting\r\n"
|
|
|
464 |
. "Time: This is a recurring meeting Meet anytime\r\n"
|
|
|
465 |
. "\r\n"
|
|
|
466 |
. "Join Zoom Meeting\r\n"
|
|
|
467 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
468 |
. "\r\n"
|
|
|
469 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
470 |
. "Passcode: 123123\r\n"
|
|
|
471 |
. "\r\n"
|
|
|
472 |
. "One tap mobile\r\n"
|
|
|
473 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
474 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
475 |
. "\r\n"
|
|
|
476 |
. "Dial by your location\r\n"
|
|
|
477 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
478 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
479 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
480 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
481 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
482 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
483 |
. "Passcode: 123456\r\n"
|
|
|
484 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
485 |
. "\r\n"
|
|
|
486 |
. "Join by SIP\r\n"
|
|
|
487 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
488 |
. "\r\n"
|
|
|
489 |
. "Join by H.323\r\n"
|
|
|
490 |
. "162.255.37.11 (US West)\r\n"
|
|
|
491 |
. "162.255.36.11 (US East)\r\n"
|
|
|
492 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
493 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
494 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
495 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
496 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
497 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
498 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
499 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
500 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
501 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
502 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
503 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
504 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
505 |
. "Passcode: 44730043";
|
|
|
506 |
$this->assertEquals($expectedmessage, $message);
|
|
|
507 |
|
|
|
508 |
// Test a recurring meeting with fixed time.
|
|
|
509 |
$message = (new invitation($this->get_mock_invitation_message_recurringfixed()))->get_display_string($zoom->cmid);
|
|
|
510 |
$expectedmessage = "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
511 |
. "\r\n"
|
|
|
512 |
. "Topic: Zoom Meeting\r\n"
|
|
|
513 |
. "Time: Mar 15, 2021 06:08 AM London\r\n"
|
|
|
514 |
. " Every day, until Mar 17, 2021, 3 occurrence(s)\r\n"
|
|
|
515 |
. " Mar 15, 2021 06:08 AM\r\n"
|
|
|
516 |
. " Mar 16, 2021 06:08 AM\r\n"
|
|
|
517 |
. " Mar 17, 2021 06:08 AM\r\n"
|
|
|
518 |
. "\r\n"
|
|
|
519 |
. "Join Zoom Meeting\r\n"
|
|
|
520 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
521 |
. "\r\n"
|
|
|
522 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
523 |
. "Passcode: 123123\r\n"
|
|
|
524 |
. "\r\n"
|
|
|
525 |
. "One tap mobile\r\n"
|
|
|
526 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
527 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
528 |
. "\r\n"
|
|
|
529 |
. "Dial by your location\r\n"
|
|
|
530 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
531 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
532 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
533 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
534 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
535 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
536 |
. "Passcode: 123456\r\n"
|
|
|
537 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
538 |
. "\r\n"
|
|
|
539 |
. "Join by SIP\r\n"
|
|
|
540 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
541 |
. "\r\n"
|
|
|
542 |
. "Join by H.323\r\n"
|
|
|
543 |
. "162.255.37.11 (US West)\r\n"
|
|
|
544 |
. "162.255.36.11 (US East)\r\n"
|
|
|
545 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
546 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
547 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
548 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
549 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
550 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
551 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
552 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
553 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
554 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
555 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
556 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
557 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
558 |
. "Passcode: 44730043";
|
|
|
559 |
$this->assertEquals($expectedmessage, $message);
|
|
|
560 |
|
|
|
561 |
// We expect that the debugging was called two times:
|
|
|
562 |
// - one time for the scheduled meeting
|
|
|
563 |
// - one time for the recurring meeting with no fixed time.
|
|
|
564 |
$debugmessage = 'No match found in zoom invitation for element: "icallink"'
|
|
|
565 |
. ' with pattern: "/^.+download and import the following iCalendar.+$\n.+$/mi".';
|
|
|
566 |
$this->assertDebuggingCalledCount(2, [$debugmessage, $debugmessage]);
|
|
|
567 |
}
|
|
|
568 |
|
|
|
569 |
/**
|
|
|
570 |
* Test not removing the iCal link from the zoom meeting message.
|
|
|
571 |
*/
|
|
|
572 |
public function test_display_message_does_not_have_icallink_removed_if_setting_disabled(): void {
|
|
|
573 |
$this->resetAfterTest();
|
|
|
574 |
$this->setAdminUser();
|
|
|
575 |
set_config('invitationremoveicallink', '0', 'zoom');
|
|
|
576 |
$course = $this->getDataGenerator()->create_course();
|
|
|
577 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
578 |
|
|
|
579 |
// Test a scheduled meeting.
|
|
|
580 |
$message = (new invitation(
|
|
|
581 |
$this->get_mock_invitation_message_scheduledmeeting()
|
|
|
582 |
))->get_display_string($zoom->cmid);
|
|
|
583 |
$expectedmessage = "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
584 |
. "\r\n"
|
|
|
585 |
. "Topic: Zoom Meeting\r\n"
|
|
|
586 |
. "Time: Mar 15, 2021 06:08 AM London\r\n"
|
|
|
587 |
. "\r\n"
|
|
|
588 |
. "Join Zoom Meeting\r\n"
|
|
|
589 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
590 |
. "\r\n"
|
|
|
591 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
592 |
. "Passcode: 123123\r\n"
|
|
|
593 |
. "\r\n"
|
|
|
594 |
. "One tap mobile\r\n"
|
|
|
595 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
596 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
597 |
. "\r\n"
|
|
|
598 |
. "Dial by your location\r\n"
|
|
|
599 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
600 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
601 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
602 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
603 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
604 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
605 |
. "Passcode: 123456\r\n"
|
|
|
606 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
607 |
. "\r\n"
|
|
|
608 |
. "Join by SIP\r\n"
|
|
|
609 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
610 |
. "\r\n"
|
|
|
611 |
. "Join by H.323\r\n"
|
|
|
612 |
. "162.255.37.11 (US West)\r\n"
|
|
|
613 |
. "162.255.36.11 (US East)\r\n"
|
|
|
614 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
615 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
616 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
617 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
618 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
619 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
620 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
621 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
622 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
623 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
624 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
625 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
626 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
627 |
. "Passcode: 44730043";
|
|
|
628 |
$this->assertEquals($expectedmessage, $message);
|
|
|
629 |
|
|
|
630 |
// Test a recurring meeting with no fixed time.
|
|
|
631 |
$message = (new invitation(
|
|
|
632 |
$this->get_mock_invitation_message_recurringnofixed()
|
|
|
633 |
))->get_display_string($zoom->cmid);
|
|
|
634 |
$expectedmessage = "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
635 |
. "\r\n"
|
|
|
636 |
. "Topic: Zoom Meeting\r\n"
|
|
|
637 |
. "Time: This is a recurring meeting Meet anytime\r\n"
|
|
|
638 |
. "\r\n"
|
|
|
639 |
. "Join Zoom Meeting\r\n"
|
|
|
640 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
641 |
. "\r\n"
|
|
|
642 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
643 |
. "Passcode: 123123\r\n"
|
|
|
644 |
. "\r\n"
|
|
|
645 |
. "One tap mobile\r\n"
|
|
|
646 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
647 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
648 |
. "\r\n"
|
|
|
649 |
. "Dial by your location\r\n"
|
|
|
650 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
651 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
652 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
653 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
654 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
655 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
656 |
. "Passcode: 123456\r\n"
|
|
|
657 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
658 |
. "\r\n"
|
|
|
659 |
. "Join by SIP\r\n"
|
|
|
660 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
661 |
. "\r\n"
|
|
|
662 |
. "Join by H.323\r\n"
|
|
|
663 |
. "162.255.37.11 (US West)\r\n"
|
|
|
664 |
. "162.255.36.11 (US East)\r\n"
|
|
|
665 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
666 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
667 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
668 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
669 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
670 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
671 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
672 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
673 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
674 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
675 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
676 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
677 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
678 |
. "Passcode: 44730043";
|
|
|
679 |
$this->assertEquals($expectedmessage, $message);
|
|
|
680 |
|
|
|
681 |
// Test a recurring meeting with fixed time.
|
|
|
682 |
$message = (new invitation($this->get_mock_invitation_message_recurringfixed()))->get_display_string($zoom->cmid);
|
|
|
683 |
$expectedmessage = "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
684 |
. "\r\n"
|
|
|
685 |
. "Topic: Zoom Meeting\r\n"
|
|
|
686 |
. "Time: Mar 15, 2021 06:08 AM London\r\n"
|
|
|
687 |
. " Every day, until Mar 17, 2021, 3 occurrence(s)\r\n"
|
|
|
688 |
. " Mar 15, 2021 06:08 AM\r\n"
|
|
|
689 |
. " Mar 16, 2021 06:08 AM\r\n"
|
|
|
690 |
. " Mar 17, 2021 06:08 AM\r\n"
|
|
|
691 |
. "Please download and import the following iCalendar (.ics) files to your calendar system.\r\n"
|
|
|
692 |
. "Zoom Meeting: https://us02web.zoom.us/meeting/u7Utd-GqqTkiEtEkvHci3z_X0W3TMjX_Avua/ics?icsToken="
|
|
|
693 |
. "88tyKu-prjsiGNOXuBGCR_McAoigWerwtnpHj7d4lwnNACkAeDzOZtURBp91KOfx\r\n"
|
|
|
694 |
. "\r\n"
|
|
|
695 |
. "Join Zoom Meeting\r\n"
|
|
|
696 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
697 |
. "\r\n"
|
|
|
698 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
699 |
. "Passcode: 123123\r\n"
|
|
|
700 |
. "\r\n"
|
|
|
701 |
. "One tap mobile\r\n"
|
|
|
702 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
703 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
704 |
. "\r\n"
|
|
|
705 |
. "Dial by your location\r\n"
|
|
|
706 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
707 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
708 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
709 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
710 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
711 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
712 |
. "Passcode: 123456\r\n"
|
|
|
713 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
714 |
. "\r\n"
|
|
|
715 |
. "Join by SIP\r\n"
|
|
|
716 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
717 |
. "\r\n"
|
|
|
718 |
. "Join by H.323\r\n"
|
|
|
719 |
. "162.255.37.11 (US West)\r\n"
|
|
|
720 |
. "162.255.36.11 (US East)\r\n"
|
|
|
721 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
722 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
723 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
724 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
725 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
726 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
727 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
728 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
729 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
730 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
731 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
732 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
733 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
734 |
. "Passcode: 44730043";
|
|
|
735 |
$this->assertEquals($expectedmessage, $message);
|
|
|
736 |
}
|
|
|
737 |
|
|
|
738 |
/**
|
|
|
739 |
* Test get_display_string returns null without throwing an error if the invitation string provided is null.
|
|
|
740 |
*/
|
|
|
741 |
public function test_display_message_when_instantiated_with_null_zoom_meeting_invitation(): void {
|
|
|
742 |
$this->resetAfterTest();
|
|
|
743 |
$this->setAdminUser();
|
|
|
744 |
$course = $this->getDataGenerator()->create_course();
|
|
|
745 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
746 |
$message = (new invitation(null))->get_display_string($zoom->cmid);
|
|
|
747 |
$this->assertNull($message);
|
|
|
748 |
}
|
|
|
749 |
|
|
|
750 |
/**
|
|
|
751 |
* Test display message is returned in full regardless of capabilities if regex patterns are disabled.
|
|
|
752 |
*/
|
|
|
753 |
public function test_display_message_when_user_has_no_capabilities_with_regex_disabled(): void {
|
|
|
754 |
set_config('invitationregexenabled', 0, 'zoom');
|
|
|
755 |
$this->resetAfterTest();
|
|
|
756 |
$this->setAdminUser();
|
|
|
757 |
$user = $this->getDataGenerator()->create_user();
|
|
|
758 |
$course = $this->getDataGenerator()->create_course();
|
|
|
759 |
$role = $this->getDataGenerator()->create_role();
|
|
|
760 |
$zoom = $this->getDataGenerator()->create_module('zoom', ['course' => $course]);
|
|
|
761 |
role_assign($role, $user->id, context_course::instance($course->id));
|
|
|
762 |
$message = (new invitation(
|
|
|
763 |
$this->get_mock_invitation_message_scheduledmeeting()
|
|
|
764 |
))->get_display_string($zoom->cmid, $user->id);
|
|
|
765 |
$expectedmessage = $this->get_mock_invitation_message_scheduledmeeting();
|
|
|
766 |
$this->assertEquals($expectedmessage, $message);
|
|
|
767 |
}
|
|
|
768 |
|
|
|
769 |
/**
|
|
|
770 |
* Get a mock zoom invitation email message for a scheduled meeting.
|
|
|
771 |
*
|
|
|
772 |
* @return string
|
|
|
773 |
*/
|
|
|
774 |
private function get_mock_invitation_message_scheduledmeeting(): string {
|
|
|
775 |
return "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
776 |
. "\r\n"
|
|
|
777 |
. "Topic: Zoom Meeting\r\n"
|
|
|
778 |
. "Time: Mar 15, 2021 06:08 AM London\r\n"
|
|
|
779 |
. "\r\n"
|
|
|
780 |
. "Join Zoom Meeting\r\n"
|
|
|
781 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
782 |
. "\r\n"
|
|
|
783 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
784 |
. "Passcode: 123123\r\n"
|
|
|
785 |
. "One tap mobile\r\n"
|
|
|
786 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
787 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
788 |
. "\r\n"
|
|
|
789 |
. "Dial by your location\r\n"
|
|
|
790 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
791 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
792 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
793 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
794 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
795 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
796 |
. "Passcode: 123456\r\n"
|
|
|
797 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
798 |
. "\r\n"
|
|
|
799 |
. "Join by SIP\r\n"
|
|
|
800 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
801 |
. "\r\n"
|
|
|
802 |
. "Join by H.323\r\n"
|
|
|
803 |
. "162.255.37.11 (US West)\r\n"
|
|
|
804 |
. "162.255.36.11 (US East)\r\n"
|
|
|
805 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
806 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
807 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
808 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
809 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
810 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
811 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
812 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
813 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
814 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
815 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
816 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
817 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
818 |
. "Passcode: 44730043\r";
|
|
|
819 |
}
|
|
|
820 |
|
|
|
821 |
/**
|
|
|
822 |
* Get a mock zoom invitation email message for a recurring meeting with no fixed time.
|
|
|
823 |
*
|
|
|
824 |
* @return string
|
|
|
825 |
*/
|
|
|
826 |
private function get_mock_invitation_message_recurringnofixed(): string {
|
|
|
827 |
return "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
828 |
. "\r\n"
|
|
|
829 |
. "Topic: Zoom Meeting\r\n"
|
|
|
830 |
. "Time: This is a recurring meeting Meet anytime\r\n"
|
|
|
831 |
. "\r\n"
|
|
|
832 |
. "Join Zoom Meeting\r\n"
|
|
|
833 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
834 |
. "\r\n"
|
|
|
835 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
836 |
. "Passcode: 123123\r\n"
|
|
|
837 |
. "One tap mobile\r\n"
|
|
|
838 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
839 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
840 |
. "\r\n"
|
|
|
841 |
. "Dial by your location\r\n"
|
|
|
842 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
843 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
844 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
845 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
846 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
847 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
848 |
. "Passcode: 123456\r\n"
|
|
|
849 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
850 |
. "\r\n"
|
|
|
851 |
. "Join by SIP\r\n"
|
|
|
852 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
853 |
. "\r\n"
|
|
|
854 |
. "Join by H.323\r\n"
|
|
|
855 |
. "162.255.37.11 (US West)\r\n"
|
|
|
856 |
. "162.255.36.11 (US East)\r\n"
|
|
|
857 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
858 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
859 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
860 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
861 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
862 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
863 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
864 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
865 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
866 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
867 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
868 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
869 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
870 |
. "Passcode: 44730043\r";
|
|
|
871 |
}
|
|
|
872 |
|
|
|
873 |
/**
|
|
|
874 |
* Get a mock zoom invitation email message for a recurring meeting with fixed time.
|
|
|
875 |
*
|
|
|
876 |
* @return string
|
|
|
877 |
*/
|
|
|
878 |
private function get_mock_invitation_message_recurringfixed(): string {
|
|
|
879 |
return "Organization is inviting you to a scheduled Zoom meeting.\r\n"
|
|
|
880 |
. "\r\n"
|
|
|
881 |
. "Topic: Zoom Meeting\r\n"
|
|
|
882 |
. "Time: Mar 15, 2021 06:08 AM London\r\n"
|
|
|
883 |
. " Every day, until Mar 17, 2021, 3 occurrence(s)\r\n"
|
|
|
884 |
. " Mar 15, 2021 06:08 AM\r\n"
|
|
|
885 |
. " Mar 16, 2021 06:08 AM\r\n"
|
|
|
886 |
. " Mar 17, 2021 06:08 AM\r\n"
|
|
|
887 |
. "Please download and import the following iCalendar (.ics) files to your calendar system.\r\n"
|
|
|
888 |
. "Zoom Meeting: https://us02web.zoom.us/meeting/u7Utd-GqqTkiEtEkvHci3z_X0W3TMjX_Avua/ics?icsToken="
|
|
|
889 |
. "88tyKu-prjsiGNOXuBGCR_McAoigWerwtnpHj7d4lwnNACkAeDzOZtURBp91KOfx\r\n"
|
|
|
890 |
. "\r\n"
|
|
|
891 |
. "Join Zoom Meeting\r\n"
|
|
|
892 |
. "https://us02web.zoom.us/j/12341234123?pwd=THBLWExVS0QyYnV1Z1nZTDJGYVI2QT09\r\n"
|
|
|
893 |
. "\r\n"
|
|
|
894 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
895 |
. "Passcode: 123123\r\n"
|
|
|
896 |
. "One tap mobile\r\n"
|
|
|
897 |
. "+61323452345,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
898 |
. "+61312341234,,12341234123#,,,,*123456# Australia\r\n"
|
|
|
899 |
. "\r\n"
|
|
|
900 |
. "Dial by your location\r\n"
|
|
|
901 |
. " +61 3 5678 5678 Australia\r\n"
|
|
|
902 |
. " +61 3 4567 4567 Australia\r\n"
|
|
|
903 |
. " +61 3 3456 3456 Australia\r\n"
|
|
|
904 |
. " +61 3 2345 2345 Australia\r\n"
|
|
|
905 |
. " +61 3 1234 1234 Australia\r\n"
|
|
|
906 |
. "Meeting ID: 123 1234 1234\r\n"
|
|
|
907 |
. "Passcode: 123456\r\n"
|
|
|
908 |
. "Find your local number: https://us02web.zoom.us/u/abcde12345\r\n"
|
|
|
909 |
. "\r\n"
|
|
|
910 |
. "Join by SIP\r\n"
|
|
|
911 |
. "1231231231234@zoomabc.com\r\n"
|
|
|
912 |
. "\r\n"
|
|
|
913 |
. "Join by H.323\r\n"
|
|
|
914 |
. "162.255.37.11 (US West)\r\n"
|
|
|
915 |
. "162.255.36.11 (US East)\r\n"
|
|
|
916 |
. "115.114.131.7 (India Mumbai)\r\n"
|
|
|
917 |
. "115.114.115.7 (India Hyderabad)\r\n"
|
|
|
918 |
. "213.19.144.110 (Amsterdam Netherlands)\r\n"
|
|
|
919 |
. "213.244.140.110 (Germany)\r\n"
|
|
|
920 |
. "103.122.166.55 (Australia Sydney)\r\n"
|
|
|
921 |
. "103.122.167.55 (Australia Melbourne)\r\n"
|
|
|
922 |
. "149.137.40.110 (Singapore)\r\n"
|
|
|
923 |
. "64.211.144.160 (Brazil)\r\n"
|
|
|
924 |
. "69.174.57.160 (Canada Toronto)\r\n"
|
|
|
925 |
. "65.39.152.160 (Canada Vancouver)\r\n"
|
|
|
926 |
. "207.226.132.110 (Japan Tokyo)\r\n"
|
|
|
927 |
. "149.137.24.110 (Japan Osaka)\r\n"
|
|
|
928 |
. "Meeting ID: 966 7989 3993\r\n"
|
|
|
929 |
. "Passcode: 44730043\r";
|
|
|
930 |
}
|
|
|
931 |
}
|