diff --git a/lib/tests/fixtures/testable_core_media_player.php b/lib/tests/fixtures/testable_core_media_player.php new file mode 100644 index 00000000000..f095542c92f --- /dev/null +++ b/lib/tests/fixtures/testable_core_media_player.php @@ -0,0 +1,65 @@ +. + +/** + * Fixture for testing the functionality of core_media_player. + * + * @package core + * @subpackage fixtures + * @category test + * @copyright 2012 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +/** + * Media player stub for testing purposes. + */ +class media_test_plugin extends core_media_player { + /** @var array Array of supported extensions */ + public $ext; + /** @var int Player rank */ + public $rank; + /** @var int Arbitrary number */ + public $num; + + /** + * @param int $num Number (used in output) + * @param int $rank Player rank + * @param array $ext Array of supported extensions + */ + public function __construct($num = 1, $rank = 13, $ext = array('mp3', 'flv', 'f4v', 'mp4')) { + $this->ext = $ext; + $this->rank = $rank; + $this->num = $num; + } + + public function embed($urls, $name, $width, $height, $options) { + self::pick_video_size($width, $height); + $contents = "\ntestsource=". join("\ntestsource=", $urls) . + "\ntestname=$name\ntestwidth=$width\ntestheight=$height\n\n"; + return html_writer::span($contents, 'mediaplugin mediaplugin_test'); + } + + public function get_supported_extensions() { + return $this->ext; + } + + public function get_rank() { + return 10; + } +} \ No newline at end of file diff --git a/lib/tests/medialib_test.php b/lib/tests/medialib_test.php index 194cc1958d5..8b230c94b1b 100644 --- a/lib/tests/medialib_test.php +++ b/lib/tests/medialib_test.php @@ -17,13 +17,14 @@ /** * Test classes for handling embedded media (audio/video). * - * @package core_media - * @category phpunit + * @package core + * @category test * @copyright 2012 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); +require_once(__DIR__ . '/fixtures/testable_core_media_player.php'); /** * Test script for media embedding. @@ -495,42 +496,4 @@ class core_medialib_testcase extends advanced_testcase { } return $out; } -} - -/** - * Media player stub for testing purposes. - */ -class media_test_plugin extends core_media_player { - /** @var array Array of supported extensions */ - public $ext; - /** @var int Player rank */ - public $rank; - /** @var int Arbitrary number */ - public $num; - - /** - * @param int $num Number (used in output) - * @param int $rank Player rank - * @param array $ext Array of supported extensions - */ - public function __construct($num = 1, $rank = 13, $ext = array('mp3', 'flv', 'f4v', 'mp4')) { - $this->ext = $ext; - $this->rank = $rank; - $this->num = $num; - } - - public function embed($urls, $name, $width, $height, $options) { - self::pick_video_size($width, $height); - $contents = "\ntestsource=". join("\ntestsource=", $urls) . - "\ntestname=$name\ntestwidth=$width\ntestheight=$height\n\n"; - return html_writer::span($contents, 'mediaplugin mediaplugin_test'); - } - - public function get_supported_extensions() { - return $this->ext; - } - - public function get_rank() { - return 10; - } -} +} \ No newline at end of file