Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 39 and 400] [Versions 400 and 402] [Versions 400 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: 509 lines (21 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: filetypes_util_test  - 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_listed()   X-Ref
Test checking that a type is among others.


test_get_not_listed()   X-Ref
Test getting types not present in a list.


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, $list, $expected)   X-Ref
Test is_allowed_file_type().

param: string $filename The filename to check
param: string $list 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.

test_deprecation_is_whitelisted()   X-Ref
Test that a debugging noticed is displayed when calling is_whitelisted().


test_deprecation_get_not_whitelisted()   X-Ref
Test that a debugging noticed is displayed when calling get_not_whitelisted().