mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-56549 media_html5audio: Add test for native extensions support.
This is to verify that all files of html_audio mime type extensions are passing list_supported_urls method correctly.
This commit is contained in:
parent
043ba1b221
commit
4d8b88fd63
@ -60,7 +60,7 @@ class media_html5audio_testcase extends advanced_testcase {
|
||||
/**
|
||||
* 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 @@ class media_html5audio_testcase extends advanced_testcase {
|
||||
$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).
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user