Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403] [Versions 39 and 310]

Unit tests for question backup and restore.

Copyright: 2018 Shamim Rezaie <shamim@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 388 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: core_question_backup_testcase  - X-Ref

Class core_question_backup_testcase

backup_course($course)   X-Ref
Makes a backup of the course.

param: stdClass $course The course object.
return: string Unique identifier for this backup.

restore_course($backupid, $fullname, $shortname, $categoryid, $expectedprecheckwarning = [])   X-Ref
Restores a backup that has been made earlier.

param: string $backupid The unique identifier of the backup.
param: string $fullname Full name of the new course that is going to be created.
param: string $shortname Short name of the new course that is going to be created.
param: int $categoryid The course category the backup is going to be restored in.
param: string[] $expectedprecheckwarning
return: int The new course id.

test_backup_question_tags()   X-Ref
This function tests backup and restore of question tags and course level question tags.


test_backup_question_author_retained_when_enrolled()   X-Ref
Test that the question author is retained when they are enrolled in to the course.


test_backup_question_author_retained_when_not_enrolled()   X-Ref
Test that the question author is retained when they are not enrolled in to the course,
but we are restoring the backup at the same site.


test_backup_question_author_reset()   X-Ref
Test that the current user is set as a question author when we are restoring the backup
at the another site and the question author is not enrolled in to the course.