Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Class: backup_restore_test  - X-Ref

PHPUnit tests for backup and restore functionality.

setUp()   X-Ref
Called before every test.


create_quiz_with_template()   X-Ref
A helper method to create a quiz with template usage of SEB.

return: quiz_settings

backup_and_restore_quiz()   X-Ref
A helper method to emulate backup and restore of the quiz.

return: \cm_info|null

backup_quiz()   X-Ref
A helper method to backup test quiz.

return: mixed A backup ID ready to be restored.

restore_quiz($backupid)   X-Ref
A helper method to restore provided backup.

param: string $backupid Backup ID to restore.

change_site()   X-Ref
A helper method to emulate restoring to a different site.


validate_backup_restore(\cm_info $newcm)   X-Ref
A helper method to validate backup and restore results.

param: cm_info $newcm Restored course_module object.

test_backup_restore_no_seb()   X-Ref
Test backup and restore when no seb.


test_backup_restore_manual_config()   X-Ref
Test backup and restore when manually configured.


test_backup_restore_template_config()   X-Ref
Test backup and restore when using template.


test_backup_restore_uploaded_config()   X-Ref
Test backup and restore when using uploaded file.


test_restore_template_to_a_different_site_when_the_same_template_exists()   X-Ref
No new template should be restored if restoring to a different site,
but the template with  the same name and content exists..


test_restore_template_to_a_different_site_when_the_same_content_but_different_name()   X-Ref
A new template should be restored if restoring to a different site, but existing template
has the same content, but different name.


test_restore_template_to_a_different_site_when_the_same_name_but_different_content()   X-Ref
A new template should be restored if restoring to a different site, but existing template
has the same name, but different content.