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 39 and 310]

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.

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

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

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

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