Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 310] [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

Provides the {@link core_form\filetypes_util_testcase} class.

Copyright: 2017 David Mudrák <david@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 487 lines (20 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: filetypes_util_testcase  - X-Ref

Test cases for the {@link core_form\filetypes_util} class.

test_normalize_file_types()   X-Ref
Test normalizing list of extensions.


test_looks_like_mimetype()   X-Ref
Test MIME type formal recognition.


test_is_filetype_group()   X-Ref
Test getting/checking group.


test_describe_file_types()   X-Ref
Test describing list of extensions.


test_expand()   X-Ref
Test expanding mime types into extensions.


test_is_whitelisted()   X-Ref
Test checking that a type is among others.


test_get_not_whitelisted()   X-Ref
Test getting types not present in a whitelist.


test_data_for_browser()   X-Ref
Test populating the tree for the browser.


is_allowed_file_type_provider()   X-Ref
Data provider for testing test_is_allowed_file_type.

return: array

test_is_allowed_file_type($filename, $whitelist, $expected)   X-Ref
Test is_allowed_file_type().

param: string $filename The filename to check
param: string $whitelist The space , or ; separated list of types supported
param: boolean $expected The expected result. True if the file is allowed, false if not.

get_unknown_file_types_provider()   X-Ref
Data provider for testing test_get_unknown_file_types.

return: array

test_get_unknown_file_types($filetypes, $expected)   X-Ref
Test get_unknown_file_types().

param: string $filetypes The filetypes to check
param: array $expected The expected result. The list of non existant file types.