Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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

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_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.