Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
Tests for Moodle 2 format backup operation.
Copyright: | 2014 The Open University |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1094 lines (49 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
core_backup_moodle2_testcase:: (19 methods):
test_backup_availability()
test_restore_legacy_availability()
test_duplicate_availability()
test_restore_dates()
test_restore_frontpage()
backup_and_restore()
duplicate()
prepare_for_enrolments_test()
test_restore_without_users_without_enrolments()
test_restore_without_users_with_enrolments()
test_restore_with_users_without_enrolments()
test_restore_with_users_with_enrolments()
test_restore_with_users_with_enrolments_merging()
test_restore_with_users_with_enrolments_deleting()
test_block_instance_times_backup()
test_restore_search_index_requests()
test_restore_course_using_plan_defaults()
test_restore_question_category_34_35()
test_contentbank_content_backup()
Class: core_backup_moodle2_testcase - X-Ref
Tests for Moodle 2 format backup operation.test_backup_availability() X-Ref |
Tests the availability field on modules and sections is correctly backed up and restored. |
test_restore_legacy_availability() X-Ref |
The availability data format was changed in Moodle 2.7. This test ensures that a Moodle 2.6 backup with this data can still be correctly restored. |
test_duplicate_availability() X-Ref |
Tests the backup and restore of single activity to same course (duplicate) when it contains availability conditions that depend on other items in course. |
test_restore_dates() X-Ref |
When restoring a course, you can change the start date, which shifts other dates. This test checks that certain dates are correctly modified. |
test_restore_frontpage() X-Ref |
Test front page backup/restore and duplicate activities return: void |
backup_and_restore($course, $newdate = 0, $inbetween = null) X-Ref |
Backs a course up and restores it. param: stdClass $course Course object to backup param: int $newdate If non-zero, specifies custom date for new course param: callable|null $inbetween If specified, function that is called before restore return: int ID of newly restored course |
duplicate($course, $cmid) X-Ref |
Duplicates a single activity within a course. This is based on the code from course/modduplicate.php, but reduced for simplicity. param: stdClass $course Course object param: int $cmid Activity to duplicate return: int ID of new activity |
prepare_for_enrolments_test($target, $additionalcaps = []) X-Ref |
Help function for enrolment methods backup/restore tests: - Creates a course ($course), adds self-enrolment method and a user - Makes a backup - Creates a target course (if requested) ($newcourseid) - Initialises restore controller for this backup file ($rc) param: int $target target for restoring: backup::TARGET_NEW_COURSE etc. param: array $additionalcaps - additional capabilities to give to user return: array array of original course, new course id, restore controller: [$course, $newcourseid, $rc] |
test_restore_without_users_without_enrolments() X-Ref |
Backup a course with enrolment methods and restore it without user data and without enrolment methods |
test_restore_without_users_with_enrolments() X-Ref |
Backup a course with enrolment methods and restore it without user data with enrolment methods |
test_restore_with_users_without_enrolments() X-Ref |
Backup a course with enrolment methods and restore it with user data and without enrolment methods |
test_restore_with_users_with_enrolments() X-Ref |
Backup a course with enrolment methods and restore it with user data with enrolment methods |
test_restore_with_users_with_enrolments_merging() X-Ref |
Backup a course with enrolment methods and restore it with user data with enrolment methods merging into another course |
test_restore_with_users_with_enrolments_deleting() X-Ref |
Backup a course with enrolment methods and restore it with user data with enrolment methods into another course deleting it's contents |
test_block_instance_times_backup() X-Ref |
Test the block instance time fields (timecreated, timemodified) through a backup and restore. |
test_restore_search_index_requests() X-Ref |
When you restore a site with global search (or search indexing) turned on, then it should add entries to the search index requests table so that the data gets indexed. |
test_restore_course_using_plan_defaults() X-Ref |
Test restoring courses based on the backup plan. Primarily used with the import functionality |
test_restore_question_category_34_35() X-Ref |
The Question category hierarchical structure was changed in Moodle 3.5. From 3.5, all question categories in each context are a child of a single top level question category for that context. This test ensures that both Moodle 3.4 and 3.5 backups can still be correctly restored. |
test_contentbank_content_backup() X-Ref |
Test the content bank content through a backup and restore. |