Search moodle.org's
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 35 and 37] [Versions 36 and 37] [Versions 37 and 310] [Versions 37 and 311] [Versions 37 and 38] [Versions 37 and 39]

    External calendar functions unit tests

    Copyright: 2012 Ankit Agarwal
    License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
    File Size: 2699 lines (120 kb)
    Included or required:0 times
    Referenced: 1 time
    Includes or requires: 0 files

    Defines 1 class

    core_calendar_externallib_testcase:: (46 methods):
      setUp()
      create_calendar_event()
      test_create_calendar_events()
      test_delete_calendar_events()
      test_get_calendar_events()
      test_core_create_calendar_events()
      test_get_calendar_action_events_by_timesort_after_time()
      test_get_calendar_action_events_by_timesort_before_time()
      test_get_calendar_events_override()
      test_get_calendar_action_events_by_timesort_time_range()
      test_get_calendar_action_events_by_timesort_time_limit_offset()
      test_get_calendar_action_events_by_timesort_suspended_course()
      test_get_calendar_action_events_by_course_after_time()
      test_get_calendar_action_events_by_course_before_time()
      test_get_calendar_action_events_by_course_time_range()
      test_get_calendar_action_events_by_course_time_limit_offset()
      test_get_action_events_by_courses()
      test_delete_calendar_events_for_modules()
      test_update_event_start_day()
      test_update_event_start_day_no_permission()
      test_update_event_start_day_module_event()
      test_submit_create_update_form_validation_error()
      test_submit_create_update_form_create_user_event()
      test_submit_create_update_form_create_user_event_no_permission()
      test_submit_create_update_form_create_site_event()
      test_submit_create_update_form_create_site_event_no_permission()
      test_submit_create_update_form_create_course_event()
      test_submit_create_update_form_create_course_event_no_permission()
      test_submit_create_update_form_create_course_event_not_enrolled()
      test_submit_create_update_form_create_group_event_group_member_manage_course()
      test_submit_create_update_form_create_group_event_group_member_manage_group_entries()
      test_submit_create_update_form_create_group_event_access_all_groups()
      test_submit_create_update_form_create_group_event_non_member_no_permission()
      test_get_calendar_monthly_view_no_course_permission()
      test_get_calendar_day_view_no_course_permission()
      test_get_calendar_upcoming_view_no_course_permission()
      test_get_calendar_event_by_id_no_course_permission()
      test_get_calendar_events_hidden_category()
      test_get_calendar_access_information_for_admins()
      test_get_calendar_access_information_for_authenticated_users()
      test_get_calendar_access_information_for_student_users()
      test_get_calendar_access_information_for_teacher_users()
      test_get_allowed_event_types_for_admins()
      test_get_allowed_event_types_for_authenticated_users()
      test_get_allowed_event_types_for_student_users()
      test_get_allowed_event_types_for_teacher_users()


    Class: core_calendar_externallib_testcase  - X-Ref

    External course functions unit tests

    setUp()   X-Ref
    Tests set up


    create_calendar_event($name, $userid = 0, $type = 'user', $repeats = 0, $timestart = null, $prop = null)   X-Ref
    No description

    test_create_calendar_events()   X-Ref
    No description

    test_delete_calendar_events()   X-Ref
    Test delete_calendar_events


    test_get_calendar_events()   X-Ref
    Test get_calendar_events


    test_core_create_calendar_events()   X-Ref
    Test core_calendar_external::create_calendar_events


    test_get_calendar_action_events_by_timesort_after_time()   X-Ref
    Requesting calendar events from a given time should return all events with a sort
    time at or after the requested time. All events prior to that time should not
    be return.

    If there are no events on or after the given time then an empty result set should
    be returned.

    test_get_calendar_action_events_by_timesort_before_time()   X-Ref
    Requesting calendar events before a given time should return all events with a sort
    time at or before the requested time (inclusive). All events after that time
    should not be returned.

    If there are no events before the given time then an empty result set should be
    returned.

    test_get_calendar_events_override()   X-Ref
    Test retrieving event that was overridden for a user


    test_get_calendar_action_events_by_timesort_time_range()   X-Ref
    Requesting calendar events within a given time range should return all events with
    a sort time between the lower and upper time bound (inclusive).

    If there are no events in the given time range then an empty result set should be
    returned.

    test_get_calendar_action_events_by_timesort_time_limit_offset()   X-Ref
    Requesting calendar events within a given time range and a limit and offset should return
    the number of events up to the given limit value that have a sort time between the lower
    and uppper time bound (inclusive) where the result set is shifted by the offset value.

    If there are no events in the given time range then an empty result set should be
    returned.

    test_get_calendar_action_events_by_timesort_suspended_course()   X-Ref
    Check that it is possible to restrict the calendar events to events where the user is not suspended in the course.


    test_get_calendar_action_events_by_course_after_time()   X-Ref
    Requesting calendar events from a given course and time should return all
    events with a sort time at or after the requested time. All events prior
    to that time should not be return.

    If there are no events on or after the given time then an empty result set should
    be returned.

    test_get_calendar_action_events_by_course_before_time()   X-Ref
    Requesting calendar events for a course and before a given time should return
    all events with a sort time at or before the requested time (inclusive). All
    events after that time should not be returned.

    If there are no events before the given time then an empty result set should be
    returned.

    test_get_calendar_action_events_by_course_time_range()   X-Ref
    Requesting calendar events for a course and within a given time range should
    return all events with a sort time between the lower and upper time bound
    (inclusive).

    If there are no events in the given time range then an empty result set should be
    returned.

    test_get_calendar_action_events_by_course_time_limit_offset()   X-Ref
    Requesting calendar events for a course and within a given time range and a limit
    and offset should return the number of events up to the given limit value that have
    a sort time between the lower and uppper time bound (inclusive) where the result
    set is shifted by the offset value.

    If there are no events in the given time range then an empty result set should be
    returned.

    test_get_action_events_by_courses()   X-Ref
    Test that get_action_events_by_courses will return a list of events for each
    course you provided as long as the user is enrolled in the course.


    test_delete_calendar_events_for_modules()   X-Ref
    Test for deleting module events.


    test_update_event_start_day()   X-Ref
    Updating the event start day should change the date value but leave
    the time of day unchanged.


    test_update_event_start_day_no_permission()   X-Ref
    A user should not be able to edit an event that they don't have
    capabilities for.


    test_update_event_start_day_module_event()   X-Ref
    A user should not be able to update a module event.


    test_submit_create_update_form_validation_error()   X-Ref
    Submit a request where the time duration until is earlier than the time
    start in order to get a validation error from the server.


    test_submit_create_update_form_create_user_event()   X-Ref
    A user with the moodle/calendar:manageownentries capability at the
    system context should be able to create a user event.


    test_submit_create_update_form_create_user_event_no_permission()   X-Ref
    A user without the moodle/calendar:manageownentries capability at the
    system context should not be able to create a user event.


    test_submit_create_update_form_create_site_event()   X-Ref
    A user with the moodle/calendar:manageentries capability at the
    site course context should be able to create a site event.


    test_submit_create_update_form_create_site_event_no_permission()   X-Ref
    A user without the moodle/calendar:manageentries capability at the
    site course context should not be able to create a site event.


    test_submit_create_update_form_create_course_event()   X-Ref
    A user that has the moodle/calendar:manageentries in a course that they
    are enrolled in should be able to create a course event in that course.


    test_submit_create_update_form_create_course_event_no_permission()   X-Ref
    A user without the moodle/calendar:manageentries capability in a course
    that they are enrolled in should not be able to create a course event in that course.


    test_submit_create_update_form_create_course_event_not_enrolled()   X-Ref
    A user should not be able to create an event for a course that they are
    not enrolled in.


    test_submit_create_update_form_create_group_event_group_member_manage_course()   X-Ref
    A user should be able to create an event for a group that they are a member of in
    a course in which they are enrolled and have the moodle/calendar:manageentries capability.


    test_submit_create_update_form_create_group_event_group_member_manage_group_entries()   X-Ref
    A user should be able to create an event for a group that they are a member of in
    a course in which they are enrolled and have the moodle/calendar:managegroupentries capability.


    test_submit_create_update_form_create_group_event_access_all_groups()   X-Ref
    A user should be able to create an event for any group in a course in which
    they are enrolled and have the moodle/site:accessallgroups capability.


    test_submit_create_update_form_create_group_event_non_member_no_permission()   X-Ref
    A user should not be able to create an event for any group that they are not a
    member of in a course in which they are enrolled but don't have the
    moodle/site:accessallgroups capability.


    test_get_calendar_monthly_view_no_course_permission()   X-Ref
    A user should not be able load the calendar monthly view for a course they cannot access.


    test_get_calendar_day_view_no_course_permission()   X-Ref
    A user should not be able load the calendar day view for a course they cannot access.


    test_get_calendar_upcoming_view_no_course_permission()   X-Ref
    A user should not be able load the calendar upcoming view for a course they cannot access.


    test_get_calendar_event_by_id_no_course_permission()   X-Ref
    A user should not be able load the calendar event for a course they cannot access.


    test_get_calendar_events_hidden_category()   X-Ref
    A user should not be able load the calendar events for a category they cannot see.


    test_get_calendar_access_information_for_admins()   X-Ref
    Test get_calendar_access_information for admins.


    test_get_calendar_access_information_for_authenticated_users()   X-Ref
    Test get_calendar_access_information for authenticated users.


    test_get_calendar_access_information_for_student_users()   X-Ref
    Test get_calendar_access_information for student users.


    test_get_calendar_access_information_for_teacher_users()   X-Ref
    Test get_calendar_access_information for teacher users.


    test_get_allowed_event_types_for_admins()   X-Ref
    Test get_allowed_event_types for admins.


    test_get_allowed_event_types_for_authenticated_users()   X-Ref
    Test get_allowed_event_types for authenticated users.


    test_get_allowed_event_types_for_student_users()   X-Ref
    Test get_allowed_event_types for student users.


    test_get_allowed_event_types_for_teacher_users()   X-Ref
    Test get_allowed_event_types for teacher users.