diff --git a/media/player/html5audio/tests/player_test.php b/media/player/html5audio/tests/player_test.php index 0c243c2bfd6f4..7dfe8e4f1ff0d 100644 --- a/media/player/html5audio/tests/player_test.php +++ b/media/player/html5audio/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() { global $CFG; require_once($CFG->libdir . '/filelib.php'); @@ -72,6 +72,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_audio'); + + // Create list of URLs for each extension. + $urls = array_map(function($ext){ + return new moodle_url('http://example.org/audio.' . $ext); + }, $nativeextensions); + + // Make sure that the list of supported URLs is not filtering permitted extensions. + $player = new media_html5audio_plugin(); + $this->assertCount(count($urls), $player->list_supported_urls($urls)); + } + /** * Test embedding without media filter (for example for displaying file resorce). */