Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

   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\output;
  18  
  19  use mod_bigbluebuttonbn\instance;
  20  use mod_bigbluebuttonbn\recording;
  21  use mod_bigbluebuttonbn\test\testcase_helper_trait;
  22  
  23  /**
  24   * Recording row
  25   *
  26   * @package   mod_bigbluebuttonbn
  27   * @copyright 2010 onwards, Blindside Networks Inc
  28   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  29   * @author    Laurent David  (laurent.david [at] call-learning [dt] fr)
  30   */
  31  class recording_row_playback_test extends \advanced_testcase {
  32      use testcase_helper_trait;
  33  
  34      /**
  35       * Setup for test
  36       */
  37      public function setUp(): void {
  38          parent::setUp();
  39          $this->initialise_mock_server();
  40      }
  41  
  42      /**
  43       * Recording sample data
  44       */
  45      const RECORDING_DATA = [
  46          [
  47              'status' => recording::RECORDING_STATUS_PROCESSED,
  48              'playback' => [
  49                  'format' =>
  50                      [
  51                          [
  52  
  53                              'type' => 'podcast',
  54                              'url' => 'http://mypodcast',
  55                              'processingTime' => 0,
  56                              'length' => 0,
  57  
  58                          ],
  59                          [
  60  
  61                              'type' => 'presentation',
  62                              'url' => 'http://mypresentation',
  63                              'processingTime' => 0,
  64                              'length' => 0,
  65  
  66                          ],
  67                          [
  68  
  69                              'type' => 'video',
  70                              'url' => 'http://myvideo',
  71                              'processingTime' => 0,
  72                              'length' => 0,
  73  
  74                          ],
  75                          [
  76  
  77                              'type' => 'settings',
  78                              'url' => 'http://mysettings',
  79                              'processingTime' => 0,
  80                              'length' => 0,
  81  
  82                          ]
  83                      ]
  84              ]
  85          ]
  86      ];
  87  
  88      /**
  89       * Test recording link is rendered for imported recordings.
  90       *
  91       * @return void
  92       * @covers       \recording_row_playback::should_be_included
  93       */
  94      public function test_show_recording_links(): void {
  95          global $PAGE;
  96          $this->resetAfterTest();
  97          set_config('bigbluebuttonbn_importrecordings_enabled', 1);
  98          $plugingenerator = $this->getDataGenerator()->get_plugin_generator('mod_bigbluebuttonbn');
  99          ['recordings' => $recordingsdata, 'activity' => $activity] = $this->create_activity_with_recordings(
 100              $this->get_course(),
 101              instance::TYPE_ALL,
 102              self::RECORDING_DATA
 103          );
 104          $recording = new recording(0, $recordingsdata[0]);
 105          $instance = instance::get_from_instanceid($activity->id);
 106          // Now create a new activity and import the recording.
 107          $newactivity = $plugingenerator->create_instance([
 108              'course' => $instance->get_course_id(),
 109              'type' => instance::TYPE_ALL,
 110              'name' => 'Example 2',
 111          ]);
 112          $plugingenerator->create_meeting([
 113              'instanceid' => $newactivity->id,
 114          ]);
 115          $newinstance = instance::get_from_instanceid($newactivity->id);
 116          // Import recording into new instance.
 117          $importedrecording = $recording->create_imported_recording($newinstance);
 118          $importedrowplayback = new recording_row_playback($importedrecording, $newinstance);
 119          $importedrowinfo = $importedrowplayback->export_for_template($PAGE->get_renderer('mod_bigbluebuttonbn'));
 120          $this->assertNotEmpty($importedrowinfo->playbacks);
 121      }
 122  }