Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 45... Línea 45...
45
    }
45
    }
Línea 46... Línea 46...
46
 
46
 
47
    /**
47
    /**
48
     * Test that plugin is returned as enabled media plugin.
48
     * Test that plugin is returned as enabled media plugin.
49
     */
49
     */
50
    public function test_is_installed() {
50
    public function test_is_installed(): void {
51
        $sortorder = \core\plugininfo\media::get_enabled_plugins();
51
        $sortorder = \core\plugininfo\media::get_enabled_plugins();
52
        $this->assertEquals(['html5video' => 'html5video'], $sortorder);
52
        $this->assertEquals(['html5video' => 'html5video'], $sortorder);
Línea 53... Línea 53...
53
    }
53
    }
54
 
54
 
55
    /**
55
    /**
56
     * Test method get_supported_extensions()
56
     * Test method get_supported_extensions()
57
     */
57
     */
Línea 58... Línea 58...
58
    public function test_get_supported_extensions() {
58
    public function test_get_supported_extensions(): void {
59
        $nativeextensions = file_get_typegroup('extension', 'html_video');
59
        $nativeextensions = file_get_typegroup('extension', 'html_video');
60
 
60
 
Línea 65... Línea 65...
65
    }
65
    }
Línea 66... Línea 66...
66
 
66
 
67
    /**
67
    /**
68
     * Test method list_supported_urls()
68
     * Test method list_supported_urls()
69
     */
69
     */
70
    public function test_list_supported_urls() {
70
    public function test_list_supported_urls(): void {
71
        global $CFG;
71
        global $CFG;
Línea 72... Línea 72...
72
        require_once($CFG->libdir . '/filelib.php');
72
        require_once($CFG->libdir . '/filelib.php');
Línea 84... Línea 84...
84
    }
84
    }
Línea 85... Línea 85...
85
 
85
 
86
    /**
86
    /**
87
     * Test embedding without media filter (for example for displaying file resorce).
87
     * Test embedding without media filter (for example for displaying file resorce).
88
     */
88
     */
89
    public function test_embed_url() {
89
    public function test_embed_url(): void {
Línea 90... Línea 90...
90
        global $CFG;
90
        global $CFG;
Línea 91... Línea 91...
91
 
91
 
Línea 114... Línea 114...
114
    /**
114
    /**
115
     * Test that mediaplugin filter replaces a link to the supported file with media tag.
115
     * Test that mediaplugin filter replaces a link to the supported file with media tag.
116
     *
116
     *
117
     * filter_mediaplugin is enabled by default.
117
     * filter_mediaplugin is enabled by default.
118
     */
118
     */
119
    public function test_embed_link() {
119
    public function test_embed_link(): void {
120
        global $CFG;
120
        global $CFG;
121
        $url = new \moodle_url('http://example.org/some_filename.mp4');
121
        $url = new \moodle_url('http://example.org/some_filename.mp4');
122
        $text = \html_writer::link($url, 'Watch this one');
122
        $text = \html_writer::link($url, 'Watch this one');
123
        $content = format_text($text, FORMAT_HTML);
123
        $content = format_text($text, FORMAT_HTML);
Línea 130... Línea 130...
130
    }
130
    }
Línea 131... Línea 131...
131
 
131
 
132
    /**
132
    /**
133
     * Test that mediaplugin filter does not work on <video> tags.
133
     * Test that mediaplugin filter does not work on <video> tags.
134
     */
134
     */
135
    public function test_embed_media() {
135
    public function test_embed_media(): void {
136
        $url = new \moodle_url('http://example.org/some_filename.mp4');
136
        $url = new \moodle_url('http://example.org/some_filename.mp4');
137
        $trackurl = new \moodle_url('http://example.org/some_filename.vtt');
137
        $trackurl = new \moodle_url('http://example.org/some_filename.vtt');
138
        $text = '<video controls="true"><source src="'.$url.'"/><source src="somethinginvalid"/>' .
138
        $text = '<video controls="true"><source src="'.$url.'"/><source src="somethinginvalid"/>' .
139
            '<track src="'.$trackurl.'">Unsupported text</video>';
139
            '<track src="'.$trackurl.'">Unsupported text</video>';