Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 47... Línea 47...
47
 * @category   test
47
 * @category   test
48
 * @copyright  2020 Amaia Anabitarte <amaia@moodle.com>
48
 * @copyright  2020 Amaia Anabitarte <amaia@moodle.com>
49
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
49
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
50
 * @coversDefaultClass \core_contentbank\contentbank
50
 * @coversDefaultClass \core_contentbank\contentbank
51
 */
51
 */
52
class contentbank_test extends advanced_testcase {
52
final class contentbank_test extends advanced_testcase {
Línea 53... Línea 53...
53
 
53
 
54
    /**
54
    /**
55
     * Setup to ensure that fixtures are loaded.
55
     * Setup to ensure that fixtures are loaded.
56
     */
56
     */
Línea 63... Línea 63...
63
    /**
63
    /**
64
     * Data provider for test_get_extension_supporter.
64
     * Data provider for test_get_extension_supporter.
65
     *
65
     *
66
     * @return  array
66
     * @return  array
67
     */
67
     */
68
    public function get_extension_provider() {
68
    public static function get_extension_provider(): array {
69
        return [
69
        return [
70
            'H5P file' => ['something.h5p', '.h5p'],
70
            'H5P file' => ['something.h5p', '.h5p'],
71
            'PDF file' => ['something.pdf', '.pdf']
71
            'PDF file' => ['something.pdf', '.pdf']
72
        ];
72
        ];
73
    }
73
    }
Línea 93... Línea 93...
93
    /**
93
    /**
94
     * Data provider for test_load_context_supported_extensions.
94
     * Data provider for test_load_context_supported_extensions.
95
     *
95
     *
96
     * @return  array
96
     * @return  array
97
     */
97
     */
98
    public function get_extension_supporters_provider() {
98
    public static function get_extension_supporters_provider(): array {
99
        return [
99
        return [
100
            'H5P first' => [['.h5p' => ['h5p', 'testable']], '.h5p', 'h5p'],
100
            'H5P first' => [['.h5p' => ['h5p', 'testable']], '.h5p', 'h5p'],
101
            'Testable first (but upload not implemented)' => [['.h5p' => ['testable', 'h5p']], '.h5p', 'h5p'],
101
            'Testable first (but upload not implemented)' => [['.h5p' => ['testable', 'h5p']], '.h5p', 'h5p'],
102
        ];
102
        ];
103
    }
103
    }
Línea 206... Línea 206...
206
     * @param  string $where Context where to search.
206
     * @param  string $where Context where to search.
207
     * @param  int $expectedresult Expected result.
207
     * @param  int $expectedresult Expected result.
208
     * @param  array $contexts List of contexts where to create content.
208
     * @param  array $contexts List of contexts where to create content.
209
     */
209
     */
210
    public function test_search_contents(?string $search, string $where, int $expectedresult, array $contexts = [],
210
    public function test_search_contents(?string $search, string $where, int $expectedresult, array $contexts = [],
211
            array $contenttypes = null): void {
211
            ?array $contenttypes = null): void {
212
        global $DB, $CFG;
212
        global $DB, $CFG;
Línea 213... Línea 213...
213
 
213
 
214
        $this->resetAfterTest();
214
        $this->resetAfterTest();
Línea 257... Línea 257...
257
    /**
257
    /**
258
     * Data provider for test_search_contents().
258
     * Data provider for test_search_contents().
259
     *
259
     *
260
     * @return array
260
     * @return array
261
     */
261
     */
262
    public function search_contents_provider(): array {
262
    public static function search_contents_provider(): array {
Línea 263... Línea 263...
263
 
263
 
264
        return [
264
        return [
265
            'Search all content in all contexts' => [
265
            'Search all content in all contexts' => [
266
                null,
266
                null,
Línea 517... Línea 517...
517
    /**
517
    /**
518
     * Data provider for get_contenttypes_with_capability_feature.
518
     * Data provider for get_contenttypes_with_capability_feature.
519
     *
519
     *
520
     * @return  array
520
     * @return  array
521
     */
521
     */
522
    public function get_contenttypes_with_capability_feature_provider(): array {
522
    public static function get_contenttypes_with_capability_feature_provider(): array {
523
        return [
523
        return [
524
            'no-contenttypes_enabled' => [
524
            'no-contenttypes_enabled' => [
525
                'contenttypesenabled' => [],
525
                'contenttypesenabled' => [],
526
                'contenttypescanfeature' => [],
526
                'contenttypescanfeature' => [],
527
            ],
527
            ],