Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 31... Línea 31...
31
 * @package    core_h5p
31
 * @package    core_h5p
32
 * @category   test
32
 * @category   test
33
 * @copyright  2019 Victor Deniz <victor@moodle.com>
33
 * @copyright  2019 Victor Deniz <victor@moodle.com>
34
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35
 * @runTestsInSeparateProcesses
35
 * @runTestsInSeparateProcesses
-
 
36
 * @covers \core_h5p\file_storage
36
 */
37
 */
37
class file_storage_test extends \advanced_testcase {
38
final class file_storage_test extends \advanced_testcase {
Línea 38... Línea 39...
38
 
39
 
39
    /** @var \core_h5p\file_storage H5P file storage instance */
40
    /** @var \core_h5p\file_storage H5P file storage instance */
40
    protected $h5p_file_storage;
41
    protected $h5p_file_storage;
41
    /** @var \file_storage Core Moodle file_storage associated to the H5P file_storage */
42
    /** @var \file_storage Core Moodle file_storage associated to the H5P file_storage */
Línea 473... Línea 474...
473
     * |- h5p.json
474
     * |- h5p.json
474
     */
475
     */
475
    public function test_saveFileFromZip(): void {
476
    public function test_saveFileFromZip(): void {
Línea 476... Línea 477...
476
 
477
 
477
        $ziparchive = new zip_archive();
478
        $ziparchive = new zip_archive();
478
        $path = __DIR__ . '/fixtures/h5ptest.zip';
479
        $path = self::get_fixture_path(__NAMESPACE__, 'h5ptest.zip');
Línea 479... Línea 480...
479
        $result = $ziparchive->open($path, file_archive::OPEN);
480
        $result = $ziparchive->open($path, file_archive::OPEN);
480
 
481
 
481
        $files = $ziparchive->list_files();
482
        $files = $ziparchive->list_files();
Línea 560... Línea 561...
560
        $factory = new \core_h5p\factory();
561
        $factory = new \core_h5p\factory();
Línea 561... Línea 562...
561
 
562
 
Línea 562... Línea 563...
562
        $admin = get_admin();
563
        $admin = get_admin();
563
 
564
 
Línea 564... Línea 565...
564
        // Prepare a valid .H5P file.
565
        // Prepare a valid .H5P file.
565
        $path = __DIR__ . '/fixtures/'.$filename;
566
        $path = self::get_fixture_path(__NAMESPACE__, $filename);
566
 
567
 
567
        // Libraries can be updated when the file has been created by admin, even when the current user is not the admin.
568
        // Libraries can be updated when the file has been created by admin, even when the current user is not the admin.
Línea 594... Línea 595...
594
    /**
595
    /**
595
     * Data provider for test_get_icon_url().
596
     * Data provider for test_get_icon_url().
596
     *
597
     *
597
     * @return array
598
     * @return array
598
     */
599
     */
599
    public function get_icon_url_provider(): array {
600
    public static function get_icon_url_provider(): array {
600
        return [
601
        return [
601
            'Icon included' => [
602
            'Icon included' => [
602
                'filltheblanks.h5p',
603
                'filltheblanks.h5p',
603
                true,
604
                true,
604
            ],
605
            ],
Línea 845... Línea 846...
845
            file_storage::CONTENT_FILEAREA, $h5pcontentid, $filepath, $filename));
846
            file_storage::CONTENT_FILEAREA, $h5pcontentid, $filepath, $filename));
846
    }
847
    }
Línea 847... Línea 848...
847
 
848
 
848
    /**
849
    /**
849
     * Test H5P custom styles generation.
-
 
850
     *
-
 
851
     * @covers ::generate_custom_styles
850
     * Test H5P custom styles generation.
852
     */
851
     */
853
    public function test_generate_custom_styles(): void {
852
    public function test_generate_custom_styles(): void {
854
        \set_config('h5pcustomcss', '.debug { color: #fab; }', 'core_h5p');
853
        \set_config('h5pcustomcss', '.debug { color: #fab; }', 'core_h5p');
855
        $h5pfsrc = new \ReflectionClass(file_storage::class);
854
        $h5pfsrc = new \ReflectionClass(file_storage::class);
Línea 893... Línea 892...
893
        );
892
        );
894
    }
893
    }
Línea 895... Línea 894...
895
 
894
 
896
    /**
895
    /**
897
     * Test H5P custom styles retrieval.
-
 
898
     *
-
 
899
     * @covers ::get_custom_styles
896
     * Test H5P custom styles retrieval.
900
     */
897
     */
901
    public function test_get_custom_styles(): void {
898
    public function test_get_custom_styles(): void {
902
        global $CFG;
899
        global $CFG;
903
        $css = '.debug { color: #fab; }';
900
        $css = '.debug { color: #fab; }';