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 310 and 402] [Versions 39 and 402]

Unit tests for mod/lesson/lib.php.

Copyright: 2017 Jun Pataleta
License: http://www.gnu.org/copyleft/gpl.html GNU Public License
File Size: 1090 lines (45 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

lib_test:: (25 methods):
  test_lesson_get_group_override_priorities()
  test_check_updates_since()
  test_lesson_core_calendar_provide_event_action_open()
  test_lesson_core_calendar_provide_event_action_open_as_non_user()
  test_lesson_core_calendar_provide_event_action_open_for_user()
  test_lesson_core_calendar_provide_event_action_open_in_hidden_section()
  test_lesson_core_calendar_provide_event_action_closed()
  test_lesson_core_calendar_provide_event_action_closed_for_user()
  test_lesson_core_calendar_provide_event_action_open_in_future()
  test_lesson_core_calendar_provide_event_action_open_in_future_for_user()
  test_lesson_core_calendar_provide_event_action_no_time_specified()
  test_lesson_core_calendar_provide_event_action_no_time_specified_for_user()
  test_lesson_core_calendar_provide_event_action_after_attempt()
  test_lesson_core_calendar_provide_event_action_after_attempt_for_user()
  test_lesson_core_calendar_provide_event_action_already_completed()
  test_lesson_core_calendar_provide_event_action_already_completed_for_user()
  create_action_event()
  test_mod_lesson_completion_get_active_rule_descriptions()
  test_mod_lesson_core_calendar_event_timestart_updated_unknown_event()
  test_mod_lesson_core_calendar_event_timestart_updated_open_event()
  test_mod_lesson_core_calendar_event_timestart_updated_close_event()
  test_mod_lesson_core_calendar_get_valid_event_timestart_range_unknown_event()
  test_mod_lesson_core_calendar_get_valid_event_timestart_range_open_event()
  test_mod_lesson_core_calendar_get_valid_event_timestart_range_close_event()
  test_creation_with_no_calendar_capabilities()


Class: lib_test  - X-Ref

Unit tests for mod/lesson/lib.php.

test_lesson_get_group_override_priorities()   X-Ref
Test for lesson_get_group_override_priorities().


test_check_updates_since()   X-Ref
Test check_updates_since callback.


test_lesson_core_calendar_provide_event_action_open()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_open_as_non_user()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_open_for_user()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_open_in_hidden_section()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_closed()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_closed_for_user()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_open_in_future()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_open_in_future_for_user()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_no_time_specified()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_no_time_specified_for_user()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_after_attempt()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_after_attempt_for_user()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_already_completed()   X-Ref
No description

test_lesson_core_calendar_provide_event_action_already_completed_for_user()   X-Ref
No description

create_action_event($courseid, $instanceid, $eventtype)   X-Ref
Creates an action event.

param: int $courseid
param: int $instanceid The lesson id.
param: string $eventtype The event type. eg. LESSON_EVENT_TYPE_OPEN.
return: bool|calendar_event

test_mod_lesson_completion_get_active_rule_descriptions()   X-Ref
Test the callback responsible for returning the completion rule descriptions.
This function should work given either an instance of the module (cm_info), such as when checking the active rules,
or if passed a stdClass of similar structure, such as when checking the the default completion settings for a mod type.


test_mod_lesson_core_calendar_event_timestart_updated_unknown_event()   X-Ref
An unknown event type should not change the lesson instance.


test_mod_lesson_core_calendar_event_timestart_updated_open_event()   X-Ref
A LESSON_EVENT_TYPE_OPEN event should update the available property of the lesson activity.


test_mod_lesson_core_calendar_event_timestart_updated_close_event()   X-Ref
A LESSON_EVENT_TYPE_CLOSE event should update the deadline property of the lesson activity.


test_mod_lesson_core_calendar_get_valid_event_timestart_range_unknown_event()   X-Ref
An unknown event type should not have any limits.


test_mod_lesson_core_calendar_get_valid_event_timestart_range_open_event()   X-Ref
The open event should be limited by the lesson's deadline property, if it's set.


test_mod_lesson_core_calendar_get_valid_event_timestart_range_close_event()   X-Ref
The close event should be limited by the lesson's available property, if it's set.


test_creation_with_no_calendar_capabilities()   X-Ref
A user who does not have capabilities to add events to the calendar should be able to create an lesson.