Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 44... Línea 44...
44
    }
44
    }
Línea 45... Línea 45...
45
 
45
 
46
    /**
46
    /**
47
     * Test that plugin is returned as enabled media plugin.
47
     * Test that plugin is returned as enabled media plugin.
48
     */
48
     */
49
    public function test_is_installed() {
49
    public function test_is_installed(): void {
50
        $sortorder = \core\plugininfo\media::get_enabled_plugins();
50
        $sortorder = \core\plugininfo\media::get_enabled_plugins();
51
        $this->assertEquals(['vimeo' => 'vimeo'], $sortorder);
51
        $this->assertEquals(['vimeo' => 'vimeo'], $sortorder);
Línea 52... Línea 52...
52
    }
52
    }
53
 
53
 
54
    /**
54
    /**
55
     * Test embedding without media filter (for example for displaying URL resorce).
55
     * Test embedding without media filter (for example for displaying URL resorce).
56
     */
56
     */
Línea 57... Línea 57...
57
    public function test_embed_url() {
57
    public function test_embed_url(): void {
Línea 58... Línea 58...
58
        global $CFG;
58
        global $CFG;
Línea 81... Línea 81...
81
    /**
81
    /**
82
     * Test that mediaplugin filter replaces a link to the supported file with media tag.
82
     * Test that mediaplugin filter replaces a link to the supported file with media tag.
83
     *
83
     *
84
     * filter_mediaplugin is enabled by default.
84
     * filter_mediaplugin is enabled by default.
85
     */
85
     */
86
    public function test_embed_link() {
86
    public function test_embed_link(): void {
87
        global $CFG;
87
        global $CFG;
88
        $url = new \moodle_url('http://vimeo.com/1176321');
88
        $url = new \moodle_url('http://vimeo.com/1176321');
89
        $text = \html_writer::link($url, 'Watch this one');
89
        $text = \html_writer::link($url, 'Watch this one');
90
        $content = format_text($text, FORMAT_HTML);
90
        $content = format_text($text, FORMAT_HTML);
Línea 98... Línea 98...
98
    /**
98
    /**
99
     * Test that mediaplugin filter adds player code on top of <video> tags.
99
     * Test that mediaplugin filter adds player code on top of <video> tags.
100
     *
100
     *
101
     * filter_mediaplugin is enabled by default.
101
     * filter_mediaplugin is enabled by default.
102
     */
102
     */
103
    public function test_embed_media() {
103
    public function test_embed_media(): void {
104
        global $CFG;
104
        global $CFG;
105
        $url = new \moodle_url('http://vimeo.com/1176321');
105
        $url = new \moodle_url('http://vimeo.com/1176321');
106
        $trackurl = new \moodle_url('http://example.org/some_filename.vtt');
106
        $trackurl = new \moodle_url('http://example.org/some_filename.vtt');
107
        $text = '<video controls="true"><source src="'.$url.'"/>' .
107
        $text = '<video controls="true"><source src="'.$url.'"/>' .
108
            '<track src="'.$trackurl.'">Unsupported text</video>';
108
            '<track src="'.$trackurl.'">Unsupported text</video>';
Línea 128... Línea 128...
128
 
128
 
129
    /**
129
    /**
130
     * Test embedding without media filter (for example for displaying URL resorce)
130
     * Test embedding without media filter (for example for displaying URL resorce)
131
     * and test that player plugin is parsing the URL with the code.
131
     * and test that player plugin is parsing the URL with the code.
132
     */
132
     */
133
    public function test_embed_url_with_code() {
133
    public function test_embed_url_with_code(): void {
Línea 134... Línea 134...
134
        global $CFG;
134
        global $CFG;
Línea 135... Línea 135...
135
 
135
 
Línea 161... Línea 161...
161
     * Test that mediaplugin filter replaces a link to the supported file with media tag
161
     * Test that mediaplugin filter replaces a link to the supported file with media tag
162
     * and test that player plugin is parsing the URL with the code.
162
     * and test that player plugin is parsing the URL with the code.
163
     *
163
     *
164
     * filter_mediaplugin is enabled by default.
164
     * filter_mediaplugin is enabled by default.
165
     */
165
     */
166
    public function test_embed_link_with_code() {
166
    public function test_embed_link_with_code(): void {
167
        global $CFG;
167
        global $CFG;
168
        $url = new \moodle_url('https://vimeo.com/1176321/abcdef12345');
168
        $url = new \moodle_url('https://vimeo.com/1176321/abcdef12345');
169
        $text = \html_writer::link($url, 'Watch this one');
169
        $text = \html_writer::link($url, 'Watch this one');
170
        $content = format_text($text, FORMAT_HTML);
170
        $content = format_text($text, FORMAT_HTML);
Línea 182... Línea 182...
182
     * Test that mediaplugin filter adds player code on top of <video> tags
182
     * Test that mediaplugin filter adds player code on top of <video> tags
183
     * and test that player plugin is parse the URL with the code.
183
     * and test that player plugin is parse the URL with the code.
184
     *
184
     *
185
     * filter_mediaplugin is enabled by default.
185
     * filter_mediaplugin is enabled by default.
186
     */
186
     */
187
    public function test_embed_media_with_code() {
187
    public function test_embed_media_with_code(): void {
188
        global $CFG;
188
        global $CFG;
189
        $url = new \moodle_url('https://vimeo.com/1176321/abcdef12345');
189
        $url = new \moodle_url('https://vimeo.com/1176321/abcdef12345');
190
        $trackurl = new \moodle_url('http://example.org/some_filename.vtt');
190
        $trackurl = new \moodle_url('http://example.org/some_filename.vtt');
191
        $text = '<video controls="true"><source src="'.$url.'"/>' .
191
        $text = '<video controls="true"><source src="'.$url.'"/>' .
192
            '<track src="'.$trackurl.'">Unsupported text</video>';
192
            '<track src="'.$trackurl.'">Unsupported text</video>';
Línea 214... Línea 214...
214
    }
214
    }
Línea 215... Línea 215...
215
 
215
 
216
    /**
216
    /**
217
     * Test that mediaplugin filter skip the process when the URL is invalid.
217
     * Test that mediaplugin filter skip the process when the URL is invalid.
218
     */
218
     */
219
    public function test_skip_invalid_url_format_with_code() {
219
    public function test_skip_invalid_url_format_with_code(): void {
220
        $url = new \moodle_url('https://vimeo.com/_________/abcdef12345s');
220
        $url = new \moodle_url('https://vimeo.com/_________/abcdef12345s');
221
        $text = \html_writer::link($url, 'Invalid Vimeo URL');
221
        $text = \html_writer::link($url, 'Invalid Vimeo URL');
Línea 222... Línea 222...
222
        $content = format_text($text, FORMAT_HTML);
222
        $content = format_text($text, FORMAT_HTML);