Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

(no description)

File Size: 1078 lines (46 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: lib_test  - X-Ref

Class contaning unit tests for the calendar lib.

setUpBeforeClass()   X-Ref
Load required test libraries


setUp()   X-Ref
Tests set up


test_get_events_with_disabled_module()   X-Ref
Test that the get_events() function only returns activity events that are enabled.


test_get_course_cached()   X-Ref
No description

test_update_subscription()   X-Ref
Test the update_subscription() function.


test_add_subscription()   X-Ref
No description

test_get_legacy_events_with_overrides()   X-Ref
Test for calendar_get_legacy_events() when there are user and group overrides.


test_calendar_get_default_courses()   X-Ref
No description

test_calendar_get_view_skip_events()   X-Ref
Confirm that the skip events flag causes the calendar_get_view function
to avoid querying for the calendar events.


test_calendar_get_allowed_event_types_course()   X-Ref
No description

test_calendar_get_allowed_event_types_group_no_acces_to_diff_groups()   X-Ref
No description

test_calendar_get_allowed_event_types_group_no_groups()   X-Ref
No description

test_calendar_get_allowed_event_types_group_access_all_groups()   X-Ref
No description

test_calendar_get_allowed_event_types_group_no_access_all_groups()   X-Ref
No description

test_calendar_get_allowed_event_types_group_cap_no_groups()   X-Ref
No description

test_calendar_get_allowed_event_types_group_cap_has_group()   X-Ref
No description

test_calendar_get_allowed_event_types_group_cap_access_all_groups()   X-Ref
No description

setup_test_calendar_set_filters()   X-Ref
This is a setup helper function that create some users, courses, groups and group memberships.
This is useful to prepare the environment for testing the calendar_set_filters function.

return: array An array of ($users, $courses, $coursegroups)

test_calendar_set_filters_not_logged_in()   X-Ref
This function tests calendar_set_filters for the case when user is not logged in.


test_calendar_set_filters_not_logged_in_with_user()   X-Ref
This function tests calendar_set_filters for the case when no one is logged in, but a user id is provided.


test_calendar_set_filters_logged_in_no_user()   X-Ref
This function tests calendar_set_filters for the case when user is logged in, but no user id is provided.


test_calendar_set_filters_logged_in_another_user()   X-Ref
This function tests calendar_set_filters for the case when a user is logged in, but another user id is provided.


test_calendar_view_event_allowed_course_event()   X-Ref
Test for calendar_view_event_allowed for course event types.


test_calendar_get_export_token_for_current_user()   X-Ref
Test for calendar_get_export_token for current user.


test_calendar_get_export_token_for_another_user()   X-Ref
Test for calendar_get_export_token for another user.


test_calendar_can_manage_user_event()   X-Ref
Test calendar_can_manage_user_event for different users.


calendar_format_event_location_provider()   X-Ref
Data provider for {@see test_calendar_format_event_location}

return: array[]

test_calendar_format_event_location(string $location, string $expectedpattern)   X-Ref
Test formatting event location

param: string $location
param: string $expectedpattern