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 (some of) mod/assign/lib.php.

Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1432 lines (57 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

mod_assign_lib_testcase:: (48 methods):
  test_print_recent_activity()
  test_print_recent_activity_fullname()
  test_print_recent_activity_fullname_blind_marking()
  test_assign_get_recent_mod_activity()
  test_assign_user_complete()
  test_assign_user_outline()
  test_assign_get_completion_state()
  test_assign_refresh_events()
  test_assign_core_calendar_is_event_visible_duedate_event_as_teacher()
  test_assign_core_calendar_is_event_visible_duedate_event_for_teacher()
  test_assign_core_calendar_is_event_visible_duedate_event_as_student()
  test_assign_core_calendar_is_event_visible_duedate_event_for_student()
  test_assign_core_calendar_is_event_visible_gradingduedate_event_as_teacher()
  test_assign_core_calendar_is_event_visible_gradingduedate_event_for_teacher()
  test_assign_core_calendar_is_event_visible_gradingduedate_event_as_student()
  test_assign_core_calendar_is_event_visible_gradingduedate_event_for_student()
  test_assign_core_calendar_provide_event_action_duedate_as_teacher()
  test_assign_core_calendar_provide_event_action_duedate_for_teacher()
  test_assign_core_calendar_provide_event_action_duedate_as_student()
  test_assign_core_calendar_provide_event_action_duedate_for_student()
  test_assign_core_calendar_provide_event_action_gradingduedate_as_teacher()
  test_assign_core_calendar_provide_event_action_gradingduedate_for_teacher()
  test_assign_core_calendar_provide_event_action_gradingduedate_as_student()
  test_assign_core_calendar_provide_event_action_gradingduedate_for_student()
  test_assign_core_calendar_provide_event_action_duedate_as_student_submitted()
  test_assign_core_calendar_provide_event_action_duedate_for_student_submitted()
  test_assign_core_calendar_provide_event_action_already_completed()
  test_assign_core_calendar_provide_event_action_already_completed_for_user()
  create_action_event()
  test_mod_assign_completion_get_active_rule_descriptions()
  test_assign_rescale_activity_grades_some_unset()
  test_assign_is_override_calendar_event_no_override()
  test_assign_is_override_calendar_event_no_nodule_event()
  test_assign_is_override_calendar_event_different_assign_instance()
  test_assign_is_override_calendar_event_user_override()
  test_assign_is_override_calendar_event_group_override()
  test_mod_assign_core_calendar_get_valid_event_timestart_range_unkown_event_type()
  test_mod_assign_core_calendar_get_valid_event_timestart_range_override_event()
  test_mod_assign_core_calendar_get_valid_event_timestart_range_due_no_limit()
  test_mod_assign_core_calendar_get_valid_event_timestart_range_due_with_limits()
  test_mod_assign_core_calendar_get_valid_event_timestart_range_gradingdue_no_limit()
  test_mod_assign_core_calendar_get_valid_event_timestart_range_gradingdue_with_due_date()
  test_mod_assign_core_calendar_event_timestart_updated_non_due_event()
  test_mod_assign_core_calendar_event_timestart_updated_due_event_override()
  test_mod_assign_core_calendar_event_timestart_updated_due_event()
  test_student_role_cant_update_due_event()
  test_teacher_role_can_update_due_event()
  test_creation_with_no_calendar_capabilities()


Class: mod_assign_lib_testcase  - X-Ref

Unit tests for (some of) mod/assign/lib.php.

test_print_recent_activity()   X-Ref
Test that assign_print_recent_activity shows ungraded submitted assignments.


test_print_recent_activity_fullname()   X-Ref
Test that assign_print_recent_activity does not display any warnings when a custom fullname has been configured.


test_print_recent_activity_fullname_blind_marking()   X-Ref
Test that assign_print_recent_activity shows the blind marking ID.


test_assign_get_recent_mod_activity()   X-Ref
Test that assign_get_recent_mod_activity fetches the assignment correctly.


test_assign_user_complete()   X-Ref
Ensure that assign_user_complete displays information about drafts.


test_assign_user_outline()   X-Ref
Ensure that assign_user_outline fetches updated grades.


test_assign_get_completion_state()   X-Ref
Ensure that assign_get_completion_state reflects the correct status at each point.


test_assign_refresh_events()   X-Ref
Tests for mod_assign_refresh_events.


test_assign_core_calendar_is_event_visible_duedate_event_as_teacher()   X-Ref
No description

test_assign_core_calendar_is_event_visible_duedate_event_for_teacher()   X-Ref
No description

test_assign_core_calendar_is_event_visible_duedate_event_as_student()   X-Ref
No description

test_assign_core_calendar_is_event_visible_duedate_event_for_student()   X-Ref
No description

test_assign_core_calendar_is_event_visible_gradingduedate_event_as_teacher()   X-Ref
No description

test_assign_core_calendar_is_event_visible_gradingduedate_event_for_teacher()   X-Ref
No description

test_assign_core_calendar_is_event_visible_gradingduedate_event_as_student()   X-Ref
No description

test_assign_core_calendar_is_event_visible_gradingduedate_event_for_student()   X-Ref
No description

test_assign_core_calendar_provide_event_action_duedate_as_teacher()   X-Ref
No description

test_assign_core_calendar_provide_event_action_duedate_for_teacher()   X-Ref
No description

test_assign_core_calendar_provide_event_action_duedate_as_student()   X-Ref
No description

test_assign_core_calendar_provide_event_action_duedate_for_student()   X-Ref
No description

test_assign_core_calendar_provide_event_action_gradingduedate_as_teacher()   X-Ref
No description

test_assign_core_calendar_provide_event_action_gradingduedate_for_teacher()   X-Ref
No description

test_assign_core_calendar_provide_event_action_gradingduedate_as_student()   X-Ref
No description

test_assign_core_calendar_provide_event_action_gradingduedate_for_student()   X-Ref
No description

test_assign_core_calendar_provide_event_action_duedate_as_student_submitted()   X-Ref
No description

test_assign_core_calendar_provide_event_action_duedate_for_student_submitted()   X-Ref
No description

test_assign_core_calendar_provide_event_action_already_completed()   X-Ref
No description

test_assign_core_calendar_provide_event_action_already_completed_for_user()   X-Ref
No description

create_action_event($course, $assign, $eventtype)   X-Ref
Creates an action event.

param: \stdClass $course The course the assignment is in
param: assign $assign The assignment to create an event for
param: string $eventtype The event type. eg. ASSIGN_EVENT_TYPE_DUE.
return: bool|calendar_event

test_mod_assign_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_assign_rescale_activity_grades_some_unset()   X-Ref
Test that if some grades are not set, they are left alone and not rescaled


test_assign_is_override_calendar_event_no_override()   X-Ref
Return false when there are not overrides for this assign instance.


test_assign_is_override_calendar_event_no_nodule_event()   X-Ref
Return false if the given event isn't an assign module event.


test_assign_is_override_calendar_event_different_assign_instance()   X-Ref
Return false if there is overrides for this use but they belong to another assign
instance.


test_assign_is_override_calendar_event_user_override()   X-Ref
Return true if there is a user override for this event and assign instance.


test_assign_is_override_calendar_event_group_override()   X-Ref
Return true if there is a group override for the event and assign instance.


test_mod_assign_core_calendar_get_valid_event_timestart_range_unkown_event_type()   X-Ref
Unknown event types should not have any limit restrictions returned.


test_mod_assign_core_calendar_get_valid_event_timestart_range_override_event()   X-Ref
Override events should not have any limit restrictions returned.


test_mod_assign_core_calendar_get_valid_event_timestart_range_due_no_limit()   X-Ref
Assignments configured without a submissions from and cutoff date should not have
any limits applied.


test_mod_assign_core_calendar_get_valid_event_timestart_range_due_with_limits()   X-Ref
Assignments should be bottom and top bound by the submissions from date and cutoff date
respectively.


test_mod_assign_core_calendar_get_valid_event_timestart_range_gradingdue_no_limit()   X-Ref
Assignment grading due date should not have any limits of no due date and cutoff date is set.


test_mod_assign_core_calendar_get_valid_event_timestart_range_gradingdue_with_due_date()   X-Ref
Assignment grading due event is minimum bound by the due date, if it is set.


test_mod_assign_core_calendar_event_timestart_updated_non_due_event()   X-Ref
Non due date events should not update the assignment due date.


test_mod_assign_core_calendar_event_timestart_updated_due_event_override()   X-Ref
Due date override events should not change the assignment due date.


test_mod_assign_core_calendar_event_timestart_updated_due_event()   X-Ref
Due date events should update the assignment due date.


test_student_role_cant_update_due_event()   X-Ref
If a student somehow finds a way to update the due date calendar event
then the callback should not be executed to update the assignment due
date as well otherwise that would be a security issue.


test_teacher_role_can_update_due_event()   X-Ref
A teacher with the capability to modify an assignment module should be
able to update the assignment due date by changing the due date calendar
event.


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 assignment.