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.

Differences Between: [Versions 39 and 400]

Restore dates test case.

Copyright: 2017 onwards Ankit Agarwal
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 163 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

restore_date_testcase:: (6 methods):
  setUp()
  backup_and_restore()
  create_course_and_module()
  assertFieldsNotRolledForward()
  assertFieldsRolledForward()
  get_diff()


Class: restore_date_testcase  - X-Ref

Advanced PHPUnit test case customised for testing restore dates in Moodle.

setUp()   X-Ref
Setup.


backup_and_restore($course, $newdate = 0)   X-Ref
Backs a course up and restores it.

return: int ID of newly restored course
param: stdClass $course Course object to backup
param: int $newdate If non-zero, specifies custom date for new course

create_course_and_module($modulename, $record = [])   X-Ref
Helper method to create a course and a module.

return: array
param: string $modulename
param: array|stdClass $record

assertFieldsNotRolledForward($oldinstance, $newinstance, $props)   X-Ref
Verify that the given properties are not rolled.

param: stdClass $oldinstance
param: stdClass $newinstance
param: [] $props

assertFieldsRolledForward($oldinstance, $newinstance, $props)   X-Ref
Verify that the given properties are rolled.

param: stdClass $oldinstance
param: stdClass $newinstance
param: [] $props

get_diff()   X-Ref
Get time diff between start date and restore date in seconds.

return: mixed