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 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

(no description)

File Size: 1294 lines (59 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 calendar/tests/helpers.php

Defines 1 class


Class: local_api_test  - X-Ref

Class contaning unit tests for the calendar local API.

setUp()   X-Ref
Tests set up


create_feedback_activity_and_event(array $feedbackproperties = [], array $eventproperties = [])   X-Ref
Create a feedback activity instance and a calendar event for
that instance.

param: array $feedbackproperties Properties to set on the feedback activity
param: array $eventproperties Properties to set on the calendar event
return: array The feedback activity and the calendar event

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_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_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_get_legacy_events_with_disabled_module()   X-Ref
Test that the get_legacy_events() function only returns activity events that are enabled.


test_get_legacy_events_with_overrides()   X-Ref
Test for \core_calendar\local\api::get_legacy_events() when there are user and group overrides.


test_update_event_start_day_updates_date()   X-Ref
Setting the start date on the calendar event should update the date
of the event but should leave the time of day unchanged.


test_update_event_start_day_no_permission()   X-Ref
A user should not be able to update the start date of the event
that they don't have the capabilities to modify.


test_update_event_start_day_activity_event_no_max()   X-Ref
Updating the start day of an event with no maximum cutoff should
update the corresponding activity property.

Note: This test uses the feedback activity because it requires
module callbacks to be in place to test.

test_update_event_start_day_activity_event_less_than_max()   X-Ref
Updating the start day of an event belonging to an activity to a value
less than the maximum cutoff should update the corresponding activity
property.

Note: This test uses the feedback activity because it requires
module callbacks to be in place to test.

test_update_event_start_day_activity_event_equal_to_max()   X-Ref
Updating the start day of an event belonging to an activity to a value
equal to the maximum cutoff should update the corresponding activity
property.

Note: This test uses the feedback activity because it requires
module callbacks to be in place to test.

test_update_event_start_day_activity_event_after_max()   X-Ref
Updating the start day of an event belonging to an activity to a value
after the maximum cutoff should not update the corresponding activity
property. Instead it should throw an exception.

Note: This test uses the feedback activity because it requires
module callbacks to be in place to test.

test_update_event_start_day_activity_event_no_min()   X-Ref
Updating the start day of an event with no minimum cutoff should
update the corresponding activity property.

Note: This test uses the feedback activity because it requires
module callbacks to be in place to test.

test_update_event_start_day_activity_event_greater_than_min()   X-Ref
Updating the start day of an event belonging to an activity to a value
greater than the minimum cutoff should update the corresponding activity
property.

Note: This test uses the feedback activity because it requires
module callbacks to be in place to test.

test_update_event_start_day_activity_event_equal_to_min()   X-Ref
Updating the start day of an event belonging to an activity to a value
equal to the minimum cutoff should update the corresponding activity
property.

Note: This test uses the feedback activity because it requires
module callbacks to be in place to test.

test_update_event_start_day_activity_event_before_min()   X-Ref
Updating the start day of an event belonging to an activity to a value
before the minimum cutoff should not update the corresponding activity
property. Instead it should throw an exception.

Note: This test uses the feedback activity because it requires
module callbacks to be in place to test.

test_update_event_start_day_activity_event_override()   X-Ref
Updating the start day of an overridden event belonging to an activity
should result in an exception. This is to prevent the drag and drop
of override events.

Note: This test uses the quiz activity because it requires
module callbacks to be in place and override event support to test.