Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Unit tests for mod/workshop/lib.php.

Copyright: 2017 Simey Lameze <simey@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 769 lines (36 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

mod_workshop_lib_testcase:: (21 methods):
  test_workshop_core_calendar_provide_event_action_open()
  test_workshop_core_calendar_provide_event_action_open_for_non_user()
  test_workshop_core_calendar_provide_event_action_open_for_user()
  test_workshop_core_calendar_provide_event_action_closed()
  test_workshop_core_calendar_provide_event_action_closed_for_non_user()
  test_workshop_core_calendar_provide_event_action_closed_for_user()
  test_workshop_core_calendar_provide_event_action_open_in_future()
  test_workshop_core_calendar_provide_event_action_open_in_future_for_non_user()
  test_workshop_core_calendar_provide_event_action_open_in_future_for_user()
  test_workshop_core_calendar_provide_event_action_no_time_specified()
  test_workshop_core_calendar_provide_event_action_no_time_specified_for_non_user()
  test_workshop_core_calendar_provide_event_action_already_completed()
  test_workshop_core_calendar_provide_event_action_already_completed_for_user()
  create_action_event()
  test_check_updates_since()
  test_mod_workshop_core_calendar_get_valid_event_timestart_range_unknown_event()
  mod_workshop_core_calendar_get_valid_event_timestart_range_due_no_limit_provider()
  test_mod_workshop_core_calendar_get_valid_event_timestart_range()
  test_mod_workshop_core_calendar_event_timestart_updated_unknown_event()
  mod_workshop_core_calendar_event_timestart_updated_provider()
  test_mod_workshop_core_calendar_event_timestart_updated()


Class: mod_workshop_lib_testcase  - X-Ref

Unit tests for mod/workshop/lib.php.

test_workshop_core_calendar_provide_event_action_open()   X-Ref
Test calendar event provide action open.


test_workshop_core_calendar_provide_event_action_open_for_non_user()   X-Ref
Test calendar event provide action open for a non user.


test_workshop_core_calendar_provide_event_action_open_for_user()   X-Ref
Test calendar event provide action open when user id is provided.


test_workshop_core_calendar_provide_event_action_closed()   X-Ref
Test calendar event provide action closed.


test_workshop_core_calendar_provide_event_action_closed_for_non_user()   X-Ref
Test calendar event provide action closed for a non user.


test_workshop_core_calendar_provide_event_action_closed_for_user()   X-Ref
Test calendar event provide action closed when user id is provided.


test_workshop_core_calendar_provide_event_action_open_in_future()   X-Ref
Test calendar event action open in future.


test_workshop_core_calendar_provide_event_action_open_in_future_for_non_user()   X-Ref
Test calendar event action open in future for a non user.


test_workshop_core_calendar_provide_event_action_open_in_future_for_user()   X-Ref
Test calendar event action open in future when user id is provided.


test_workshop_core_calendar_provide_event_action_no_time_specified()   X-Ref
Test calendar event with no time specified.


test_workshop_core_calendar_provide_event_action_no_time_specified_for_non_user()   X-Ref
Test calendar event with no time specified for a non user.


test_workshop_core_calendar_provide_event_action_already_completed()   X-Ref
No description

test_workshop_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 The course id.
param: int $instanceid The workshop id.
param: string $eventtype The event type. eg. WORKSHOP_EVENT_TYPE_OPEN.
return: bool|calendar_event

test_check_updates_since()   X-Ref
Test check_updates_since callback.


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


mod_workshop_core_calendar_get_valid_event_timestart_range_due_no_limit_provider()   X-Ref
Provider for test_mod_workshop_core_calendar_get_valid_event_timestart_range.

return: array of (submissionstart, submissionend, assessmentstart, assessmentend, eventtype, expectedmin, expectedmax)

test_mod_workshop_core_calendar_get_valid_event_timestart_range($submissionstart, $submissionend,$assessmentstart, $assessmentend, $eventtype, $expectedmin, $expectedmax)   X-Ref
Tests mod_workshop_core_calendar_get_valid_event_timestart_range in various settings.

param: int $submissionstart  The start of the submission phase
param: int $submissionend    The end of the submission phase
param: int $assessmentstart  The start of the assessment phase
param: int $assessmentend    The end of the assessment phase
param: string $eventtype     The type if the event
param: int|null $expectedmin The expected value for min of the valid event range
param: int|null $expectedmax The expected value for max of the valid event range

test_mod_workshop_core_calendar_event_timestart_updated_unknown_event()   X-Ref
An unknown event type should not change the workshop instance.


mod_workshop_core_calendar_event_timestart_updated_provider()   X-Ref
Provider for test_mod_workshop_core_calendar_event_timestart_updated.

return: array of (submissionstart, submissionend, assessmentstart, assessmentend, eventtype, fieldtoupdate, newtime)

test_mod_workshop_core_calendar_event_timestart_updated($submissionstart, $submissionend, $assessmentstart,$assessmentend, $eventtype, $fieldtoupdate, $newtime)   X-Ref
Due date events should update the workshop due date.

param: int $submissionstart  The start of the submission phase
param: int $submissionend    The end of the submission phase
param: int $assessmentstart  The start of the assessment phase
param: int $assessmentend    The end of the assessment phase
param: string $eventtype     The type if the event
param: string $fieldtoupdate The field that is supposed to be updated.
param: int $newtime          The new value for the $fieldtoupdate