Search moodle.org's
Developer Documentation

See Release Notes

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

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

(no description)

File Size: 1450 lines (55 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 1 class

weblib_test:: (48 methods):
  test_format_string()
  test_format_string_static_caching_with_filters()
  test_s()
  test_format_string_illegal_options()
  format_string_illegal_options_provider()
  test_format_string_context()
  test_format_text_email()
  test_obfuscate_email()
  test_obfuscate_text()
  test_highlight()
  test_replace_ampersands()
  test_strip_links()
  test_wikify_links()
  test_clean_text()
  test_trusttext_active()
  test_trusttext_trusted()
  trusttext_pre_edit_provider()
  test_trusttext_pre_edit()
  test_trusttext_strip()
  test_format_text_trusted()
  test_qualified_me()
  test_null_progress_trace()
  test_text_progress_trace()
  test_html_progress_trace()
  test_html_list_progress_trace()
  test_progress_trace_buffer()
  test_combined_progress_trace()
  test_set_debugging()
  test_strip_pluginfile_content()
  test_purify_html_ruby()
  test_content_to_text()
  provider_content_to_text()
  data_validate_email()
  test_validate_email()
  provider_get_file_argument()
  test_get_file_argument()
  test_extract_draft_file_urls_from_text()
  test_print_password_policy()
  get_html_lang_attribute_value_provider()
  test_get_html_lang_attribute_value()
  test_out_as_local_url_coding_exception()
  out_as_local_url_coding_exception_provider()
  test_out_as_local_url()
  out_as_local_url_provider()
  test_is_local_url()
  is_local_url_provider()
  strip_querystring_provider()
  test_strip_querystring()


Class: weblib_test  - X-Ref

Weblib tests.

test_format_string()   X-Ref


test_format_string_static_caching_with_filters()   X-Ref
The format string static caching should include the filters option to make
sure filters are correctly applied when requested.


test_s()   X-Ref


test_format_string_illegal_options(string $input,string $result,mixed $options,string $pattern,)   X-Ref
Test the format_string illegal options handling.


format_string_illegal_options_provider()   X-Ref
Data provider for test_format_string_illegal_options.

return: array

test_format_string_context()   X-Ref
Ensure that if format_string is called with a context as the third param, that a debugging notice is emitted.


test_format_text_email()   X-Ref


test_obfuscate_email()   X-Ref


test_obfuscate_text()   X-Ref


test_highlight()   X-Ref


test_replace_ampersands()   X-Ref


test_strip_links()   X-Ref


test_wikify_links()   X-Ref


test_clean_text()   X-Ref


test_trusttext_active()   X-Ref
Test trusttext enabling.


test_trusttext_trusted()   X-Ref
Test trusttext detection.


trusttext_pre_edit_provider()   X-Ref
Data provider for trusttext_pre_edit() tests.


test_trusttext_pre_edit(bool $expectedsanitised, int $enabled, string $rolename,string $format, int $trust)   X-Ref
Test text cleaning before editing.

param: bool $expectedsanitised
param: int $enabled
param: string $rolename
param: string $format
param: int $trust

test_trusttext_strip()   X-Ref
Test removal of legacy trusttext flag.


test_format_text_trusted()   X-Ref
Test trust option of format_text().


test_qualified_me()   X-Ref


test_null_progress_trace()   X-Ref


test_text_progress_trace()   X-Ref


test_html_progress_trace()   X-Ref


test_html_list_progress_trace()   X-Ref


test_progress_trace_buffer()   X-Ref


test_combined_progress_trace()   X-Ref


test_set_debugging()   X-Ref


test_strip_pluginfile_content()   X-Ref


test_purify_html_ruby()   X-Ref


test_content_to_text($content, $format, $expected)   X-Ref
Tests for content_to_text.

param: string    $content   The content
param: int|false $format    The content format
param: string    $expected  Expected value

provider_content_to_text()   X-Ref
Data provider for test_content_to_text.


data_validate_email()   X-Ref
Data provider for validate_email() function.

return: array Returns aray of test data for the test_validate_email function

test_validate_email($email, $result)   X-Ref
Tests valid and invalid email address using the validate_email() function.

param: string $email the email address to test
param: boolean $result Expected result (true or false)

provider_get_file_argument()   X-Ref
Data provider for test_get_file_argument.


test_get_file_argument($server, $cfgslasharguments, $expected)   X-Ref
Tests for get_file_argument() function.

param: array $server mockup for $_SERVER.
param: string $cfgslasharguments slasharguments setting.
param: string|false $expected Expected value.

test_extract_draft_file_urls_from_text()   X-Ref
Tests for extract_draft_file_urls_from_text() function.


test_print_password_policy()   X-Ref


get_html_lang_attribute_value_provider()   X-Ref
Data provider for the testing get_html_lang_attribute_value().

return: string[][]

test_get_html_lang_attribute_value(string $langcode, string $expected)   X-Ref
Test for get_html_lang_attribute_value().

param: string $langcode The language code to convert.
param: string $expected The expected converted value.
return: void

test_out_as_local_url_coding_exception(\moodle_url $url, string $exmessage)   X-Ref
Test the coding exceptions when returning URL as relative path from $CFG->wwwroot.

param: moodle_url $url The URL pointing to a web resource.
param: string $exmessage The expected output URL.

out_as_local_url_coding_exception_provider()   X-Ref
Data provider for throwing coding exceptions in <u>\moodle_url::out_as_local_url()</u>.

return: array

test_out_as_local_url(\moodle_url $url, string $expected)   X-Ref
Test URL as relative path from $CFG->wwwroot.

param: moodle_url $url The URL pointing to a web resource.
param: string $expected The expected local URL.

out_as_local_url_provider()   X-Ref
Data provider for returning local paths via <u>\moodle_url::out_as_local_url()</u>.

return: array

test_is_local_url(\moodle_url $url, bool $expected)   X-Ref
Test URL as relative path from $CFG->wwwroot.

param: moodle_url $url The URL pointing to a web resource.
param: bool $expected The expected result.

is_local_url_provider()   X-Ref
Data provider for testing <u>\moodle_url::is_local_url()</u>.

return: array

strip_querystring_provider()   X-Ref
Data provider for strip_querystring tests.

return: array

test_strip_querystring($value, $expected)   X-Ref
Test the strip_querystring function with various exampels.

param: mixed $value
param: mixed $expected