See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]
Unit tests for the Moodle XML format.
Copyright: | 2010 The Open University |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1854 lines (67 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
xmlformat_test:: (37 methods):
assert_same_xml()
make_test_question()
remove_irrelevant_form_data_fields()
itemid_to_files()
test_xml_escape_simple_input_not_escaped()
test_xml_escape_html_wrapped_in_cdata()
test_xml_escape_script_tag_handled_ok()
test_xml_escape_code_that_looks_like_cdata_end_ok()
test_write_hint_basic()
test_write_hint_with_parts()
test_import_hints_no_parts()
test_import_hints_with_parts()
test_import_no_hints_no_error()
test_import_description()
test_export_description()
test_import_essay_20()
test_import_essay_21()
test_import_essay_311()
test_export_essay()
test_import_match_19()
test_export_match()
test_import_multichoice_19()
test_export_multichoice()
test_import_numerical_19()
test_export_numerical()
test_import_shortanswer_19()
test_export_shortanswer()
test_import_truefalse_19()
test_import_truefalse_with_idnumber()
test_export_truefalse()
test_export_truefalse_with_idnumber()
test_import_multianswer()
test_export_multianswer()
test_export_multianswer_withdollars()
test_import_files_as_draft()
test_import_truefalse_wih_files()
test_create_dummy_question()
mock_qformat_xml:: (1 method):
mock_create_dummy_question_representing_category()
Class: xmlformat_test - X-Ref
Unit tests for the matching question definition class.assert_same_xml($expectedxml, $xml) X-Ref |
No description |
make_test_question() X-Ref |
No description |
remove_irrelevant_form_data_fields($expectedq) X-Ref |
The data the XML import format sends to save_question is not exactly the same as the data returned from the editing form, so this method makes necessary changes to the return value of \test_question_maker::get_question_form_data so that the tests can work. param: object $expectedq as returned by get_question_form_data. return: object one more likely to match the return value of import_...(). |
itemid_to_files($var) X-Ref |
Becuase XML import uses a files array instead of an itemid integer to handle saving files with a question, we need to covert the output of \test_question_maker::get_question_form_data to match. This method recursively replaces all array elements with key itemid with an array entry with key files and value an empty array. param: mixed $var any data structure. return: mixed an equivalent structure with the relacements made. |
test_xml_escape_simple_input_not_escaped() X-Ref |
No description |
test_xml_escape_html_wrapped_in_cdata() X-Ref |
No description |
test_xml_escape_script_tag_handled_ok() X-Ref |
No description |
test_xml_escape_code_that_looks_like_cdata_end_ok() X-Ref |
No description |
test_write_hint_basic() X-Ref |
No description |
test_write_hint_with_parts() X-Ref |
No description |
test_import_hints_no_parts() X-Ref |
No description |
test_import_hints_with_parts() X-Ref |
No description |
test_import_no_hints_no_error() X-Ref |
No description |
test_import_description() X-Ref |
No description |
test_export_description() X-Ref |
No description |
test_import_essay_20() X-Ref |
No description |
test_import_essay_21() X-Ref |
No description |
test_import_essay_311() X-Ref |
No description |
test_export_essay() X-Ref |
No description |
test_import_match_19() X-Ref |
No description |
test_export_match() X-Ref |
No description |
test_import_multichoice_19() X-Ref |
No description |
test_export_multichoice() X-Ref |
No description |
test_import_numerical_19() X-Ref |
No description |
test_export_numerical() X-Ref |
No description |
test_import_shortanswer_19() X-Ref |
No description |
test_export_shortanswer() X-Ref |
No description |
test_import_truefalse_19() X-Ref |
No description |
test_import_truefalse_with_idnumber() X-Ref |
No description |
test_export_truefalse() X-Ref |
No description |
test_export_truefalse_with_idnumber() X-Ref |
No description |
test_import_multianswer() X-Ref |
No description |
test_export_multianswer() X-Ref |
No description |
test_export_multianswer_withdollars() X-Ref |
No description |
test_import_files_as_draft() X-Ref |
No description |
test_import_truefalse_wih_files() X-Ref |
No description |
test_create_dummy_question() X-Ref |
No description |
Class: mock_qformat_xml - X-Ref
Class mock_qformat_xml exists only to enable testing of the create dummy question category.mock_create_dummy_question_representing_category(string $categoryname, $categoryinfo) X-Ref |
Make public an otherwise protected function. param: string $categoryname the name of the category param: object $categoryinfo description of the category |