Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 69... Línea 69...
69
    }
69
    }
Línea 70... Línea 70...
70
 
70
 
71
    /**
71
    /**
72
     * Test for core_media::get_filename.
72
     * Test for core_media::get_filename.
73
     */
73
     */
74
    public function test_get_filename() {
74
    public function test_get_filename(): void {
Línea 75... Línea 75...
75
        $manager = core_media_manager::instance();
75
        $manager = core_media_manager::instance();
76
 
76
 
77
        $this->assertSame('frog.mp4', $manager->get_filename(new \moodle_url(
77
        $this->assertSame('frog.mp4', $manager->get_filename(new \moodle_url(
Línea 83... Línea 83...
83
    }
83
    }
Línea 84... Línea 84...
84
 
84
 
85
    /**
85
    /**
86
     * Test for core_media::get_extension.
86
     * Test for core_media::get_extension.
87
     */
87
     */
88
    public function test_get_extension() {
88
    public function test_get_extension(): void {
Línea 89... Línea 89...
89
        $manager = core_media_manager::instance();
89
        $manager = core_media_manager::instance();
90
 
90
 
91
        $this->assertSame('mp4', $manager->get_extension(new \moodle_url(
91
        $this->assertSame('mp4', $manager->get_extension(new \moodle_url(
Línea 99... Línea 99...
99
    }
99
    }
Línea 100... Línea 100...
100
 
100
 
101
    /**
101
    /**
102
     * Test for the core_media_player list_supported_urls.
102
     * Test for the core_media_player list_supported_urls.
103
     */
103
     */
104
    public function test_list_supported_urls() {
104
    public function test_list_supported_urls(): void {
Línea 105... Línea 105...
105
        $test = new media_test_plugin(1, 13, ['tst', 'test']);
105
        $test = new media_test_plugin(1, 13, ['tst', 'test']);
106
 
106
 
107
        // Some example URLs.
107
        // Some example URLs.
Línea 131... Línea 131...
131
    }
131
    }
Línea 132... Línea 132...
132
 
132
 
133
    /**
133
    /**
134
     * Test for get_players
134
     * Test for get_players
135
     */
135
     */
136
    public function test_get_players() {
136
    public function test_get_players(): void {
137
        // All players are initially disabled (except link, which you can't).
137
        // All players are initially disabled (except link, which you can't).
138
        $manager = core_media_manager::instance();
138
        $manager = core_media_manager::instance();
Línea 139... Línea 139...
139
        $this->assertEmpty($this->get_players_test($manager));
139
        $this->assertEmpty($this->get_players_test($manager));
Línea 160... Línea 160...
160
    }
160
    }
Línea 161... Línea 161...
161
 
161
 
162
    /**
162
    /**
163
     * Test for can_embed_url
163
     * Test for can_embed_url
164
     */
164
     */
165
    public function test_can_embed_url() {
165
    public function test_can_embed_url(): void {
166
        // All players are initially disabled, so mp4 cannot be rendered.
166
        // All players are initially disabled, so mp4 cannot be rendered.
167
        $url = new \moodle_url('http://example.org/test.mp4');
167
        $url = new \moodle_url('http://example.org/test.mp4');
168
        $manager = core_media_manager::instance();
168
        $manager = core_media_manager::instance();
Línea 186... Línea 186...
186
 
186
 
187
    /**
187
    /**
188
     * Test for embed_url.
188
     * Test for embed_url.
189
     * Checks multiple format/fallback support.
189
     * Checks multiple format/fallback support.
190
     */
190
     */
Línea 191... Línea 191...
191
    public function test_embed_url_fallbacks() {
191
    public function test_embed_url_fallbacks(): void {
192
 
192
 
193
        // Key strings in the embed code that identify with the media formats being tested.
193
        // Key strings in the embed code that identify with the media formats being tested.
194
        $html5video = '</video>';
194
        $html5video = '</video>';
Línea 257... Línea 257...
257
 
257
 
258
    /**
258
    /**
259
     * Test for embed_url.
259
     * Test for embed_url.
260
     * SWF shouldn't be converted to objects because media_swf has been removed.
260
     * SWF shouldn't be converted to objects because media_swf has been removed.
261
     */
261
     */
262
    public function test_embed_url_swf() {
262
    public function test_embed_url_swf(): void {
Línea 263... Línea 263...
263
        $manager = core_media_manager::instance();
263
        $manager = core_media_manager::instance();
264
 
264
 
265
        // Without any options...
265
        // Without any options...
Línea 274... Línea 274...
274
    }
274
    }
Línea 275... Línea 275...
275
 
275
 
276
    /**
276
    /**
277
     * Same as test_embed_url MP3 test, but for slash arguments.
277
     * Same as test_embed_url MP3 test, but for slash arguments.
278
     */
278
     */
Línea 279... Línea 279...
279
    public function test_slash_arguments() {
279
    public function test_slash_arguments(): void {
280
 
280
 
281
        // Again we do not turn slasharguments actually on, because it has to
281
        // Again we do not turn slasharguments actually on, because it has to
Línea 294... Línea 294...
294
 
294
 
295
    /**
295
    /**
296
     * Test for embed_url.
296
     * Test for embed_url.
297
     * Checks the EMBED_OR_BLANK option.
297
     * Checks the EMBED_OR_BLANK option.
298
     */
298
     */
299
    public function test_embed_or_blank() {
299
    public function test_embed_or_blank(): void {
300
        \core\plugininfo\media::set_enabled_plugins('html5audio');
300
        \core\plugininfo\media::set_enabled_plugins('html5audio');
301
        $manager = core_media_manager::instance();
301
        $manager = core_media_manager::instance();
Línea 302... Línea 302...
302
        $this->pretend_to_be_firefox();
302
        $this->pretend_to_be_firefox();
Línea 318... Línea 318...
318
    /**
318
    /**
319
     * Test for embed_url.
319
     * Test for embed_url.
320
     * Checks that size is passed through correctly to player objects and tests
320
     * Checks that size is passed through correctly to player objects and tests
321
     * size support in html5video output.
321
     * size support in html5video output.
322
     */
322
     */
323
    public function test_embed_url_size() {
323
    public function test_embed_url_size(): void {
324
        global $CFG;
324
        global $CFG;
Línea 325... Línea 325...
325
 
325
 
326
        // Technically this could break in every format and they handle size
326
        // Technically this could break in every format and they handle size
327
        // in several different ways, but I'm too lazy to test it in every
327
        // in several different ways, but I'm too lazy to test it in every
Línea 351... Línea 351...
351
    /**
351
    /**
352
     * Test for embed_url.
352
     * Test for embed_url.
353
     * Checks that name is passed through correctly to player objects and tests
353
     * Checks that name is passed through correctly to player objects and tests
354
     * name support in html5video output.
354
     * name support in html5video output.
355
     */
355
     */
356
    public function test_embed_url_name() {
356
    public function test_embed_url_name(): void {
357
        // As for size this could break in every format but I'm only testing
357
        // As for size this could break in every format but I'm only testing
358
        // html5video.
358
        // html5video.
359
        \core\plugininfo\media::set_enabled_plugins('html5video');
359
        \core\plugininfo\media::set_enabled_plugins('html5video');
360
        $manager = core_media_manager::instance();
360
        $manager = core_media_manager::instance();
361
        $url = new \moodle_url('http://example.org/test.mp4');
361
        $url = new \moodle_url('http://example.org/test.mp4');
Línea 370... Línea 370...
370
    }
370
    }
Línea 371... Línea 371...
371
 
371
 
372
    /**
372
    /**
373
     * Test for split_alternatives.
373
     * Test for split_alternatives.
374
     */
374
     */
375
    public function test_split_alternatives() {
375
    public function test_split_alternatives(): void {
Línea 376... Línea 376...
376
        $mediamanager = core_media_manager::instance();
376
        $mediamanager = core_media_manager::instance();
377
 
377
 
378
        // Single URL - identical moodle_url.
378
        // Single URL - identical moodle_url.
Línea 407... Línea 407...
407
    }
407
    }
Línea 408... Línea 408...
408
 
408
 
409
    /**
409
    /**
410
     * Test for embed_alternatives (with multiple urls)
410
     * Test for embed_alternatives (with multiple urls)
411
     */
411
     */
412
    public function test_embed_alternatives() {
412
    public function test_embed_alternatives(): void {
413
        // Most aspects of this are same as single player so let's just try
413
        // Most aspects of this are same as single player so let's just try
Línea 414... Línea 414...
414
        // a single typical / complicated scenario.
414
        // a single typical / complicated scenario.
415
 
415
 
Línea 450... Línea 450...
450
    }
450
    }
Línea 451... Línea 451...
451
 
451
 
452
    /**
452
    /**
453
     * Make sure the instance() method returns singleton for the same page and different object for another page
453
     * Make sure the instance() method returns singleton for the same page and different object for another page
454
     */
454
     */
455
    public function test_initialise() {
455
    public function test_initialise(): void {
Línea 456... Línea 456...
456
        $moodlepage1 = new \moodle_page();
456
        $moodlepage1 = new \moodle_page();
457
 
457