See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]
Unit tests for export/import description (info) for question category in the Moodle XML format.
Copyright: | 2014 Nikita Nikitsky, Volgograd State Technical University |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 501 lines (23 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
qformat_xml_import_export_test:: (16 methods):
create_qformat()
assert_same_xml()
normalise_xml()
assert_category_imported()
assert_category_has_parent()
assert_question_in_category()
test_import_category()
test_import_nested_categories()
test_import_nested_categories_with_questions()
test_import_old_format()
test_import_categories_in_reverse_order()
test_export_category()
test_export_nested_categories()
test_export_nested_categories_with_questions()
test_export_category_with_special_chars()
test_import_broken_multianswer_questions()
Class: qformat_xml_import_export_test - X-Ref
Unit tests for the XML question format import and export.create_qformat($filename, $course) X-Ref |
Create object qformat_xml for test. param: string $filename with name for testing file. param: stdClass $course return: qformat_xml XML question format object. |
assert_same_xml($expectedxml, $xml) X-Ref |
Check xml for compliance. param: string $expectedxml with correct string. param: string $xml you want to check. |
normalise_xml($xml) X-Ref |
Clean up some XML to remove irrelevant differences, before it is compared. param: string $xml some XML. return: string cleaned-up XML. |
assert_category_imported($name, $info, $infoformat, $idnumber = null) X-Ref |
Check imported category. param: string $name imported category name. param: string $info imported category info field (description of category). param: int $infoformat imported category info field format. |
assert_category_has_parent($catname, $parentname) X-Ref |
Check a question category has a given parent. param: string $catname Name of the question category param: string $parentname Name of the parent category |
assert_question_in_category($qname, $catname) X-Ref |
Check a question exists in a category. param: string $qname The name of the question param: string $catname The name of the category |
test_import_category() X-Ref |
Simple check for importing a category with a description. |
test_import_nested_categories() X-Ref |
Check importing nested categories. |
test_import_nested_categories_with_questions() X-Ref |
Check importing nested categories contain the right questions. |
test_import_old_format() X-Ref |
Check import of an old file (without format), for backward compatability. |
test_import_categories_in_reverse_order() X-Ref |
Check the import of an xml file where the child category exists before the parent category. |
test_export_category() X-Ref |
Simple check for exporting a category. |
test_export_nested_categories() X-Ref |
Check exporting nested categories. |
test_export_nested_categories_with_questions() X-Ref |
Check exporting nested categories contain the right questions. |
test_export_category_with_special_chars() X-Ref |
Simple check for exporting a category. |
test_import_broken_multianswer_questions() X-Ref |
Test that bad multianswer questions are not imported. |