Inherited by ajax_test, backup_check_test, backup_controller_test, backup_dbops_test, backup_destinations_test, backup_factories_test, backup_helper_test, backup_plan_test, backup_step_test, backup_task_test, backup_ui_test, backuplib_test, base_atom_test, base_attribute_test, base_final_element_test, base_nested_element_test, base_optigroup_test, code_test, collatorlib_test, componentlib_test, ContainsSelectExpectation_test, ContainsTagWithAttribute_test, ContainsTagWithAttributes_test, ContainsTagWithContents_test, convert_helper_test, courselib_test, custom_menu_test, data_loading_method_test_base, data_preset_test, ddl_test, dml_test, DoesNotContainTagWithAttributes_test, duration_form_element_test, eventslib_test, externallib_test, FakeDBUnitTestCase, filelib_test, filter_manager_test, filter_mediaplugin_test, filter_urltolink_test, formslib_test, global_navigation_test, gradeedittreelib_test, grading_manager_test, html_writer_test, htmlpurifier_test, logger_test, lti_locallib_test, mathsslib_test, mod_quiz_display_options_test, modforumlib_test, moodle1_converter_test, moodle_block_manager_test, moodle_page_editing_test, moodle_page_test, moodlelib_test, moodlesimplepie_test, navbar_test, navigation_cache_test, navigation_node_test, outputlib_methods_test, progressive_parser_test, purifier_test, qbehaviour_missing_test, qbehaviour_walkthrough_test_base, qformat_default_test, qformat_gift_test, qformat_xml_test, qtype_calculated_question_test, qtype_calculated_test, qtype_calculated_variable_substituter_test, qtype_calculatedmulti_question_test, qtype_calculatedsimple_question_test, qtype_description_test, qtype_essay_question_test, qtype_essay_test, qtype_match_question_test, qtype_match_test, qtype_missing_test, qtype_multianswer_question_test, qtype_multianswer_test, qtype_multichoice_multi_question_test, qtype_multichoice_single_question_test, qtype_multichoice_test, qtype_numerical_answer_processor_test, qtype_numerical_answer_test, qtype_numerical_form_test, qtype_numerical_question_test, qtype_numerical_test, qtype_random_test, qtype_shortanswer_question_test, qtype_shortanswer_test, qtype_truefalse_question_test, qtype_truefalse_test, question_attempt_iterator_test, question_attempt_step_iterator_test, question_attempt_step_test, question_attempt_test, question_attempt_upgrader_test_base, question_attempt_with_steps_test, question_bank_test, question_cbm_test, question_engine_test, question_first_matching_answer_grading_strategy_test, question_hint_test, question_reportlib_test, question_state_test, question_type_test, question_usage_by_activity_test, question_utils_test, questionlib_test, quiz_class_test, quiz_editlib_test, quiz_lib_test, quiz_locallib_test, quiz_statistics_question_stats_test, quizaccess_delaybetweenattempts_test, quizaccess_ipaddress_test, quizaccess_numattempts_test, quizaccess_openclosedate_test, quizaccess_password_test, quizaccess_safebrowser_test, quizaccess_securewindow_test, quizaccess_timelimit_test, restore_decode_test, scorm_formatduration_test, setting_test, settings_navigation_test, TestOfTestDoxReporter, textlib_test, UnitTestCaseUsingDatabase, url_lib_test, user_picture_test, web_test, webservice_test, wikiparser_test, workshop_accumulative_strategy_test, workshop_allocation_random_test, workshop_best_evaluation_test, workshop_internal_api_test, workshop_numerrors_strategy_test, workshop_rubric_strategy_test, xhtml_container_stack_test, xml_output_test, and xml_writer_test.
Public Member Functions |
| | UnitTestCase ($label=false) |
| | assertTrue ($result, $message=false) |
| | assertFalse ($result, $message= '%s') |
| | assertNull ($value, $message= '%s') |
| | assertNotNull ($value, $message= '%s') |
| | assertIsA ($object, $type, $message= '%s') |
| | assertNotA ($object, $type, $message= '%s') |
| | assertEqual ($first, $second, $message= '%s') |
| | assertNotEqual ($first, $second, $message= '%s') |
| | assertWithinMargin ($first, $second, $margin, $message= '%s') |
| | assertOutsideMargin ($first, $second, $margin, $message= '%s') |
| | assertIdentical ($first, $second, $message= '%s') |
| | assertNotIdentical ($first, $second, $message= '%s') |
| | assertReference (&$first, &$second, $message= '%s') |
| | assertClone (&$first, &$second, $message= '%s') |
| | assertCopy (&$first, &$second, $message="%s") |
| | assertPattern ($pattern, $subject, $message= '%s') |
| | assertWantedPattern ($pattern, $subject, $message= '%s') |
| | assertNoPattern ($pattern, $subject, $message= '%s') |
| | assertNoUnwantedPattern ($pattern, $subject, $message= '%s') |
| | swallowErrors () |
| | assertNoErrors ($message= '%s') |
| | assertError ($expected=false, $message= '%s') |
| | expectError ($expected=false, $message= '%s') |
| | expectException ($expected=false, $message= '%s') |
| | _coerceExpectation ($expected) |
| | assertErrorPattern ($pattern, $message= '%s') |
Detailed Description
Definition at line 23 of file unit_tester.php.
Member Function Documentation
Creates an equality expectation if the object/value is not already some type of expectation.
- Parameters:
-
| mixed | $expected | Expected value. |
- Returns:
- SimpleExpectation Expectation object. private
Definition at line 402 of file unit_tester.php.
Will trigger a pass if both parameters refer to different objects. Fail otherwise. The objects have to be identical though.
- Parameters:
-
| mixed | $first | Object reference to check. |
| mixed | $second | Hopefully not the same object. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass public
Definition at line 259 of file unit_tester.php.
| assertCopy |
( |
&$ |
first, |
|
|
&$ |
second, |
|
|
$ |
message = "%s" |
|
) |
| |
Will trigger a pass if the two parameters have the same value only. Otherwise a fail.
- Parameters:
-
| mixed | $first | Value to compare. |
| mixed | $second | Value to compare. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass public
Definition at line 139 of file unit_tester.php.
Will be true on false and vice versa. False is the PHP definition of false, so that null, empty strings, zero and an empty array all count as false.
- Parameters:
-
| boolean | $result | Pass on false. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass public
Definition at line 62 of file unit_tester.php.
Will trigger a pass if the two parameters have the same value and same type. Otherwise a fail.
- Parameters:
-
| mixed | $first | Value to compare. |
| mixed | $second | Value to compare. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass public
Definition at line 205 of file unit_tester.php.
Type and class test. Will pass if class matches the type name or is a subclass or if not an object, but the type is correct.
- Parameters:
-
| mixed | $object | Object to test. |
| string | $type | Type name as string. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass. public
Definition at line 106 of file unit_tester.php.
Will trigger a pass if the perl regex pattern is not present in subject. Fail if found.
- Parameters:
-
| string | $pattern | Perl regex to look for including the regex delimiters. |
| string | $subject | String to search in. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass public
Definition at line 322 of file unit_tester.php.
Type and class mismatch test. Will pass if class name or underling type does not match the one specified.
- Parameters:
-
| mixed | $object | Object to test. |
| string | $type | Type name as string. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass. public
Definition at line 123 of file unit_tester.php.
Will trigger a pass if the two parameters have a different value. Otherwise a fail.
- Parameters:
-
| mixed | $first | Value to compare. |
| mixed | $second | Value to compare. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass public
Definition at line 155 of file unit_tester.php.
Will trigger a pass if the two parameters have the different value or different type.
- Parameters:
-
| mixed | $first | Value to compare. |
| mixed | $second | Value to compare. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass public
Definition at line 221 of file unit_tester.php.
Will be true if the value is set.
- Parameters:
-
| mixed | $value | Supposedly set value. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass. public
Definition at line 88 of file unit_tester.php.
Will be true if the value is null.
- Parameters:
-
| null | $value | Supposedly null value. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass public
Definition at line 73 of file unit_tester.php.
Will trigger a pass if the two parameters differ by more than the margin.
- Parameters:
-
| mixed | $first | Value to compare. |
| mixed | $second | Value to compare. |
| mixed | $margin | Fuzziness of match. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass public
Definition at line 189 of file unit_tester.php.
Will trigger a pass if the Perl regex pattern is found in the subject. Fail otherwise.
- Parameters:
-
| string | $pattern | Perl regex to look for including the regex delimiters. |
| string | $subject | String to search in. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass public
Definition at line 298 of file unit_tester.php.
Will trigger a pass if both parameters refer to the same object. Fail otherwise.
- Parameters:
-
| mixed | $first | Object reference to check. |
| mixed | $second | Hopefully the same object. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass public
Definition at line 237 of file unit_tester.php.
Called from within the test methods to register passes and failures.
- Parameters:
-
| boolean | $result | Pass on true. |
| string | $message | Message to display describing the test state. |
- Returns:
- boolean True on pass public
Definition at line 48 of file unit_tester.php.
Will trigger a pass if the if the first parameter is near enough to the second by the margin.
- Parameters:
-
| mixed | $first | Value to compare. |
| mixed | $second | Value to compare. |
| mixed | $margin | Fuzziness of match. |
| string | $message | Message to display. |
- Returns:
- boolean True on pass public
Definition at line 172 of file unit_tester.php.
Prepares for an error. If the error mismatches it passes through, otherwise it is swallowed. Any left over errors trigger failures.
- Parameters:
-
| SimpleExpectation/string | $expected The error to match. |
| string | $message | Message on failure. public |
Definition at line 371 of file unit_tester.php.
Prepares for an exception. If the error mismatches it passes through, otherwise it is swallowed. Any left over errors trigger failures.
- Parameters:
-
| SimpleExpectation/Exception | $expected The error to match. |
| string | $message | Message on failure. public |
Definition at line 385 of file unit_tester.php.
Creates an empty test case. Should be subclassed with test methods for a functional test case.
- Parameters:
-
| string | $label | Name of test case. Will use the class name if none specified. public |
Definition at line 32 of file unit_tester.php.
The documentation for this class was generated from the following file: