Differences Between: [Versions 310 and 403] [Versions 39 and 403]
Unit tests for MoodleQuickForm_duration Contains test cases for testing MoodleQuickForm_duration
Copyright: | 2009 Tim Hunt |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 218 lines (7 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
duration_test:: (10 methods):
get_test_form()
get_test_form_and_element()
test_constructor_rejects_invalid_unit()
test_constructor_limited_units()
test_get_units()
seconds_to_unit_cases()
test_seconds_to_unit()
test_seconds_to_unit_different_default_unit()
export_value_cases()
test_export_value()
temp_form_duration:: (2 methods):
definition()
getform()
Class: duration_test - X-Ref
Unit tests for MoodleQuickForm_durationget_test_form() X-Ref |
Get a form that can be used for testing. return: MoodleQuickForm |
get_test_form_and_element() X-Ref |
Get a form with a duration element that can be used for testing. return: array with two elements, a MoodleQuickForm and a MoodleQuickForm_duration. |
test_constructor_rejects_invalid_unit() X-Ref |
Test the constructor error handling. |
test_constructor_limited_units() X-Ref |
Test constructor only some units. |
test_get_units() X-Ref |
Testcase for testing units (seconds, minutes, hours and days) |
seconds_to_unit_cases() X-Ref |
Data provider for {@see test_seconds_to_unit()}. return: array test cases. |
test_seconds_to_unit(array $expected, int $seconds) X-Ref |
Testcase for testing conversion of seconds to the best possible unit. param: array $expected expected return value from seconds_to_unit param: int $seconds value to pass to seconds_to_unit |
test_seconds_to_unit_different_default_unit() X-Ref |
Testcase for testing conversion of seconds to the best possible unit with a non-default default unit. |
export_value_cases() X-Ref |
Data provider for {@see test_export_value()}. return: array test cases. |
test_export_value(int $expected, string $number, int $unit, int $enabled = 0,bool $optional = false, ?string $label = null) X-Ref |
Testcase to check generated timestamp param: int $expected Expected value returned by the element. param: string $number Number entered into the element. param: int $unit Unit selected in the element. param: int $enabled Whether the enabled checkbox on the form was selected. (Only used if $optional is true.) param: bool $optional Whether the element has the optional option on. param: string|null $label The element's label. |