Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 39 and 311]

Unit tests for /lib/formslib.php.

Copyright: 2011 Sam Hemelryk
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1016 lines (41 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 lib/tests/fixtures/namespaced_form.php

Defines 17 classes

formslib_test:: (25 methods):
  test_require_rule()
  test_range_rule()
  test_generate_id_select()
  test_generate_id_like_repeat()
  test_can_manually_set_id()
  test_generate_id_radio()
  test_radio_can_manually_set_id()
  test_generate_id_radio_like_repeat()
  test_rendering()
  test_settype_debugging_text()
  test_settype_debugging_hidden()
  test_settype_debugging_url()
  test_settype_debugging_repeat()
  test_settype_debugging_repeat_ok()
  test_settype_debugging_group()
  test_settype_debugging_namedgroup()
  test_settype_debugging_funky_name()
  test_settype_debugging_type_inheritance()
  test_settype_debugging_type_group_in_repeat()
  test_settype_debugging_type_namedgroup_in_repeat()
  test_type_cleaning()
  test_multiple_modgrade_fields()
  test_persistantrreeze_element()
  test_multiple_validation()
  test_mock_submit()

formslib_test_form:: (1 method):
  definition()

formslib_settype_debugging_text:: (1 method):
  definition()

formslib_settype_debugging_hidden:: (1 method):
  definition()

formslib_settype_debugging_url:: (1 method):
  definition()

formslib_settype_debugging_repeat:: (1 method):
  definition()

formslib_settype_debugging_repeat_ok:: (1 method):
  definition()

formslib_settype_debugging_group:: (1 method):
  definition()

formslib_settype_debugging_namedgroup:: (1 method):
  definition()

formslib_settype_debugging_funky_name:: (1 method):
  definition()

formslib_settype_debugging_type_inheritance:: (1 method):
  definition()

formslib_settype_debugging_type_group_in_repeat:: (1 method):
  definition()

formslib_settype_debugging_type_namedgroup_in_repeat:: (1 method):
  definition()

formslib_clean_value:: (2 methods):
  get_form()
  definition()

formslib_multiple_modgrade_form:: (1 method):
  definition()

formslib_persistantrreeze_element:: (1 method):
  definition()

formslib_multiple_validation_form:: (2 methods):
  definition()
  validation()


Class: formslib_test  - X-Ref

Unit tests for /lib/formslib.php.

test_require_rule()   X-Ref
No description

test_range_rule()   X-Ref
No description

test_generate_id_select()   X-Ref
No description

test_generate_id_like_repeat()   X-Ref
No description

test_can_manually_set_id()   X-Ref
No description

test_generate_id_radio()   X-Ref
No description

test_radio_can_manually_set_id()   X-Ref
No description

test_generate_id_radio_like_repeat()   X-Ref
No description

test_rendering()   X-Ref
No description

test_settype_debugging_text()   X-Ref
No description

test_settype_debugging_hidden()   X-Ref
No description

test_settype_debugging_url()   X-Ref
No description

test_settype_debugging_repeat()   X-Ref
No description

test_settype_debugging_repeat_ok()   X-Ref
No description

test_settype_debugging_group()   X-Ref
No description

test_settype_debugging_namedgroup()   X-Ref
No description

test_settype_debugging_funky_name()   X-Ref
No description

test_settype_debugging_type_inheritance()   X-Ref
No description

test_settype_debugging_type_group_in_repeat()   X-Ref
No description

test_settype_debugging_type_namedgroup_in_repeat()   X-Ref
No description

test_type_cleaning()   X-Ref
No description

test_multiple_modgrade_fields()   X-Ref
MDL-52873


test_persistantrreeze_element()   X-Ref
Test persistant freeze elements have different id's.


test_multiple_validation()   X-Ref
Ensure a validation can run at least once per object. See MDL-56259.


test_mock_submit()   X-Ref
MDL-56233 - Tests mocking a form inside a namespace.


Class: formslib_test_form  - X-Ref

Test form to be used by {@link formslib_test::test_rendering()}.

definition()   X-Ref
No description

Class: formslib_settype_debugging_text  - X-Ref

Used to test debugging is called when text added without setType.

definition()   X-Ref
No description

Class: formslib_settype_debugging_hidden  - X-Ref

Used to test debugging is called when hidden added without setType.

definition()   X-Ref
No description

Class: formslib_settype_debugging_url  - X-Ref

Used to test debugging is called when hidden added without setType.

definition()   X-Ref
No description

Class: formslib_settype_debugging_repeat  - X-Ref

Used to test debugging is called when repeated text added without setType.

definition()   X-Ref
No description

Class: formslib_settype_debugging_repeat_ok  - X-Ref

Used to no debugging is called when correctly test.

definition()   X-Ref
No description

Class: formslib_settype_debugging_group  - X-Ref

Used to test if debugging is called when a group contains elements without type.

definition()   X-Ref
No description

Class: formslib_settype_debugging_namedgroup  - X-Ref

Used to test if debugging is called when a named group contains elements without type.

definition()   X-Ref
No description

Class: formslib_settype_debugging_funky_name  - X-Ref

Used to test if debugging is called when has a funky name.

definition()   X-Ref
No description

Class: formslib_settype_debugging_type_inheritance  - X-Ref

Used to test that debugging is not called with type inheritance.

definition()   X-Ref
No description

Class: formslib_settype_debugging_type_group_in_repeat  - X-Ref

Used to test the debugging when using groups in repeated elements.

definition()   X-Ref
No description

Class: formslib_settype_debugging_type_namedgroup_in_repeat  - X-Ref

Used to test the debugging when using named groups in repeated elements.

definition()   X-Ref
No description

Class: formslib_clean_value  - X-Ref

Used to check value cleaning.

get_form()   X-Ref
No description

definition()   X-Ref
No description

Class: formslib_multiple_modgrade_form  - X-Ref

Used to test that modgrade fields get unique id attributes.

definition()   X-Ref
No description

Class: formslib_persistantrreeze_element  - X-Ref

Used to test frozen elements get unique id attributes.

definition()   X-Ref
No description

Class: formslib_multiple_validation_form  - X-Ref

Used to test that you can validate a form more than once. See MDL-56250.

definition()   X-Ref
Simple definition, one text field which can have a number.


validation($data, $files)   X-Ref
The number cannot be negative.

param: array $data An array of form data
param: array $files An array of form files
return: array Error messages