Developer Documentation

  • Bug fixes for general core bugs in 3.7.x will end 11 May 2020 (12 months).
  • Bug fixes for security issues in 3.7.x will end 9 November 2020 (18 months) - Support has ended.
  • minimum PHP 7.1.0 Note: minimum PHP version has increased since Moodle 3.6. PHP 7.2.x and 7.3.x are supported too. PHP 7.x could have some engine limitations.
  • Differences Between: [Versions 37 and 310] [Versions 37 and 311]

    This file contains the class that handles testing the calendar type system.

    Copyright: 2013 Mark Nelson <>
    License: GNU GPL v3 or later
    File Size: 329 lines (13 kb)
    Included or required:0 times
    Referenced: 0 times
    Includes or requires: 0 files

    Defines 2 classes

    Class: core_calendar_type_testcase  - X-Ref

    Unit tests for the calendar type system.

    setUp()   X-Ref
    Test set up.

    test_calendar_type_set()   X-Ref
    Test that setting the calendar type works.

    test_calendar_type_core_functions()   X-Ref
    Test that calling core Moodle functions responsible for displaying the date
    have the same results as directly calling the same function in the calendar type.

    test_calendar_type_dateselector_elements()   X-Ref
    Test that dates selected using the date selector elements are being saved as unixtime, and that the
    unixtime is being converted back to a valid date to display in the date selector elements for
    different calendar types.

    test_calendar_type_datetime_field_submission()   X-Ref
    Test that the user profile field datetime minimum and maximum year settings are saved as the
    equivalent Gregorian years.

    core_functions_test($type)   X-Ref
    Test all the core functions that use the calendar type system.

    param: string $type the calendar type we want to test

    convert_dateselector_to_unixtime_test($element, $type, $date)   X-Ref
    Simulates submitting a form with a date selector element and tests that the chosen dates
    are converted into unixtime before being saved in DB.

    param: string $element the form element we are testing
    param: string $type the calendar type we want to test
    param: array $date the date variables

    convert_unixtime_to_dateselector_test($type, $date)   X-Ref
    Test converting dates from unixtime to a date for the calendar type specified.

    param: string $type the calendar type we want to test
    param: array $date the date variables

    datetime_field_submission_test($type, $date)   X-Ref
    Test saving the minimum and max year settings for the user datetime field.

    param: string $type the calendar type we want to test
    param: array $date the date variables

    set_calendar_type($type)   X-Ref
    Set the calendar type for this user.

    param: string $type the calendar type we want to set

    Class: temp_form_calendartype  - X-Ref

    Form object to be used in test case.

    definition()   X-Ref
    Form definition.

    getform()   X-Ref
    Returns form reference

    return: MoodleQuickForm