diff --git a/media/player/html5video/tests/player_test.php b/media/player/html5video/tests/player_test.php index 7caf405685cd8..3def9af83afbb 100644 --- a/media/player/html5video/tests/player_test.php +++ b/media/player/html5video/tests/player_test.php @@ -60,7 +60,7 @@ public function test_is_installed() { /** * Test method get_supported_extensions() */ - public function test_supported_extensions() { + public function test_get_supported_extensions() { $nativeextensions = file_get_typegroup('extension', 'html_video'); // Make sure that the list of extensions from the setting is exactly the same as html_video group. @@ -69,6 +69,25 @@ public function test_supported_extensions() { $this->assertEmpty(array_diff($nativeextensions, $player->get_supported_extensions())); } + /** + * Test method list_supported_urls() + */ + public function test_list_supported_urls() { + global $CFG; + require_once($CFG->libdir . '/filelib.php'); + + $nativeextensions = file_get_typegroup('extension', 'html_video'); + + // Create list of URLs for each extension. + $urls = array_map(function($ext){ + return new moodle_url('http://example.org/video.' . $ext); + }, $nativeextensions); + + // Make sure that the list of supported URLs is not filtering permitted extensions. + $player = new media_html5video_plugin(); + $this->assertCount(count($urls), $player->list_supported_urls($urls)); + } + /** * Test embedding without media filter (for example for displaying file resorce). */