Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 39 and 402]

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