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(['youtube' => 'youtube'], $sortorder);
51
        $this->assertEquals(['youtube' => 'youtube'], $sortorder);
Línea 52... Línea 52...
52
    }
52
    }
53
 
53
 
54
    /**
54
    /**
55
     * Test supported link types
55
     * Test supported link types
56
     */
56
     */
Línea 57... Línea 57...
57
    public function test_supported() {
57
    public function test_supported(): void {
58
        $manager = core_media_manager::instance();
58
        $manager = core_media_manager::instance();
59
 
59
 
Línea 111... Línea 111...
111
    }
111
    }
Línea 112... Línea 112...
112
 
112
 
113
    /**
113
    /**
114
     * Test embedding without media filter (for example for displaying URL resorce).
114
     * Test embedding without media filter (for example for displaying URL resorce).
115
     */
115
     */
116
    public function test_embed_url() {
116
    public function test_embed_url(): void {
Línea 117... Línea 117...
117
        global $CFG;
117
        global $CFG;
Línea 118... Línea 118...
118
 
118
 
Línea 140... Línea 140...
140
    /**
140
    /**
141
     * Test that mediaplugin filter replaces a link to the supported file with media tag.
141
     * Test that mediaplugin filter replaces a link to the supported file with media tag.
142
     *
142
     *
143
     * filter_mediaplugin is enabled by default.
143
     * filter_mediaplugin is enabled by default.
144
     */
144
     */
145
    public function test_embed_link() {
145
    public function test_embed_link(): void {
146
        global $CFG;
146
        global $CFG;
147
        $url = new \moodle_url('http://www.youtube.com/v/vyrwMmsufJc');
147
        $url = new \moodle_url('http://www.youtube.com/v/vyrwMmsufJc');
148
        $text = \html_writer::link($url, 'Watch this one');
148
        $text = \html_writer::link($url, 'Watch this one');
149
        $content = format_text($text, FORMAT_HTML);
149
        $content = format_text($text, FORMAT_HTML);
Línea 157... Línea 157...
157
    /**
157
    /**
158
     * Test that mediaplugin filter adds player code on top of <video> tags.
158
     * Test that mediaplugin filter adds player code on top of <video> tags.
159
     *
159
     *
160
     * filter_mediaplugin is enabled by default.
160
     * filter_mediaplugin is enabled by default.
161
     */
161
     */
162
    public function test_embed_media() {
162
    public function test_embed_media(): void {
163
        global $CFG;
163
        global $CFG;
164
        $url = new \moodle_url('http://www.youtube.com/v/vyrwMmsufJc');
164
        $url = new \moodle_url('http://www.youtube.com/v/vyrwMmsufJc');
165
        $trackurl = new \moodle_url('http://example.org/some_filename.vtt');
165
        $trackurl = new \moodle_url('http://example.org/some_filename.vtt');
166
        $text = '<video controls="true"><source src="'.$url.'"/>' .
166
        $text = '<video controls="true"><source src="'.$url.'"/>' .
167
            '<track src="'.$trackurl.'">Unsupported text</video>';
167
            '<track src="'.$trackurl.'">Unsupported text</video>';
Línea 189... Línea 189...
189
     * Test that YouTube media plugin renders embed code correctly
189
     * Test that YouTube media plugin renders embed code correctly
190
     * when the "nocookie" config options is set to true.
190
     * when the "nocookie" config options is set to true.
191
     *
191
     *
192
     * @covers \media_youtube_plugin::embed_external
192
     * @covers \media_youtube_plugin::embed_external
193
     */
193
     */
194
    public function test_youtube_nocookie() {
194
    public function test_youtube_nocookie(): void {
195
        // Turn on the no cookie option.
195
        // Turn on the no cookie option.
196
        set_config('nocookie', true, 'media_youtube');
196
        set_config('nocookie', true, 'media_youtube');
Línea 197... Línea 197...
197
 
197
 
198
        // Test that the embed code contains the no cookie domain.
198
        // Test that the embed code contains the no cookie domain.