Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 39 and 311]

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