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 |
namespace mod_bigbluebuttonbn\local\proxy;
|
|
|
18 |
|
|
|
19 |
use mod_bigbluebuttonbn\instance;
|
|
|
20 |
use mod_bigbluebuttonbn\test\testcase_helper_trait;
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* Recording proxy tests class.
|
|
|
24 |
*
|
|
|
25 |
* @package mod_bigbluebuttonbn
|
|
|
26 |
* @copyright 2018 - present, Blindside Networks Inc
|
|
|
27 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
28 |
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com)
|
|
|
29 |
* @covers \mod_bigbluebuttonbn\local\proxy\recording_proxy
|
|
|
30 |
* @coversDefaultClass \mod_bigbluebuttonbn\local\proxy\recording_proxy
|
|
|
31 |
*/
|
|
|
32 |
class recording_proxy_test extends \advanced_testcase {
|
|
|
33 |
use testcase_helper_trait;
|
|
|
34 |
|
|
|
35 |
/**
|
|
|
36 |
* Simple recording fetcher test
|
|
|
37 |
*
|
|
|
38 |
* @return void
|
|
|
39 |
*/
|
11 |
efrain |
40 |
public function test_fetch_recordings(): void {
|
1 |
efrain |
41 |
$this->resetAfterTest();
|
|
|
42 |
$this->initialise_mock_server();
|
|
|
43 |
[$context, $cm, $bbbactivity] = $this->create_instance();
|
|
|
44 |
$instance = instance::get_from_instanceid($bbbactivity->id);
|
|
|
45 |
$recordings = $this->create_recordings_for_instance($instance, [['name' => 'Recording 1'], ['name' => 'Recording 2']]);
|
|
|
46 |
$recordingsid = array_map(function ($r) {
|
|
|
47 |
return $r->recordingid;
|
|
|
48 |
}, $recordings);
|
|
|
49 |
$recordings = recording_proxy::fetch_recordings($recordingsid);
|
|
|
50 |
$this->assertCount(2, $recordings);
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
/**
|
|
|
54 |
* Simple recording with breakoutroom fetcher test
|
|
|
55 |
*
|
|
|
56 |
* @return void
|
|
|
57 |
*/
|
11 |
efrain |
58 |
public function test_fetch_recordings_breakoutroom(): void {
|
1 |
efrain |
59 |
$this->resetAfterTest();
|
|
|
60 |
$this->initialise_mock_server();
|
|
|
61 |
[$context, $cm, $bbbactivity] = $this->create_instance();
|
|
|
62 |
$instance = instance::get_from_instanceid($bbbactivity->id);
|
|
|
63 |
$bbbgenerator = $this->getDataGenerator()->get_plugin_generator('mod_bigbluebuttonbn');
|
|
|
64 |
$mainmeeting = $bbbgenerator->create_meeting([
|
|
|
65 |
'instanceid' => $instance->get_instance_id(),
|
|
|
66 |
'groupid' => $instance->get_group_id(),
|
|
|
67 |
]);
|
|
|
68 |
// TODO: here we artificially create breakout meetings but the current implementations does not handle
|
|
|
69 |
// breakout rooms for one BBB instance. At this point we just have the ability to retrieve subrecordings
|
|
|
70 |
// from breakout rooms and manage them as if they belong to the parent recording.
|
|
|
71 |
// The meetingId is not sent to the server but autogenerated by the mock server and
|
|
|
72 |
// parentID is the meetingID from the current instance.
|
|
|
73 |
$submeeting1 = $bbbgenerator->create_meeting([
|
|
|
74 |
'instanceid' => $instance->get_instance_id(),
|
|
|
75 |
'groupid' => $instance->get_group_id(),
|
|
|
76 |
'isBreakout' => true,
|
|
|
77 |
'sequence' => 1
|
|
|
78 |
]);
|
|
|
79 |
$submeeting2 = $bbbgenerator->create_meeting([
|
|
|
80 |
'instanceid' => $instance->get_instance_id(),
|
|
|
81 |
'groupid' => $instance->get_group_id(),
|
|
|
82 |
'isBreakout' => true,
|
|
|
83 |
'sequence' => 2
|
|
|
84 |
]);
|
|
|
85 |
$recordings = $this->create_recordings_for_instance($instance, [
|
|
|
86 |
['name' => 'Recording 1'],
|
|
|
87 |
['name' => 'Recording 2', 'isBreakout' => true, 'sequence' => 1],
|
|
|
88 |
['name' => 'Recording 3', 'isBreakout' => true, 'sequence' => 2]
|
|
|
89 |
]);
|
|
|
90 |
$recordingsid = array_map(function ($r) {
|
|
|
91 |
return $r->recordingid;
|
|
|
92 |
}, $recordings);
|
|
|
93 |
$recordings = recording_proxy::fetch_recordings([$recordingsid[0]]);
|
|
|
94 |
$this->assertCount(3, $recordings);
|
|
|
95 |
}
|
|
|
96 |
}
|