See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 and 403]
Unit tests for (some of) mod/quiz/locallib.php.
Copyright: | 2008 The Open University |
License: | http://www.gnu.org/copyleft/gpl.html GNU Public License |
File Size: | 1199 lines (52 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
lib_test:: (28 methods):
test_quiz_has_grades()
test_quiz_format_grade()
test_quiz_get_grade_format()
test_quiz_format_question_grade()
test_quiz_delete_instance()
setup_quiz_for_testing_completion()
do_attempt_quiz()
test_quiz_get_completion_state_completionpass()
test_quiz_get_completion_state_completionexhausted()
test_quiz_get_completion_state_completionminattempts()
test_quiz_get_completion_state_completionminattempts_pass()
test_quiz_get_user_attempts()
test_quiz_get_group_override_priorities()
test_quiz_core_calendar_provide_event_action_open()
test_quiz_core_calendar_provide_event_action_open_for_user()
test_quiz_core_calendar_provide_event_action_closed()
test_quiz_core_calendar_provide_event_action_closed_for_user()
test_quiz_core_calendar_provide_event_action_open_in_future()
test_quiz_core_calendar_provide_event_action_open_in_future_for_user()
test_quiz_core_calendar_provide_event_action_no_capability()
test_quiz_core_calendar_provide_event_action_no_capability_for_user()
test_quiz_core_calendar_provide_event_action_already_finished()
test_quiz_core_calendar_provide_event_action_already_finished_for_user()
test_quiz_core_calendar_provide_event_action_already_completed()
test_quiz_core_calendar_provide_event_action_already_completed_for_user()
create_action_event()
test_mod_quiz_completion_get_active_rule_descriptions()
test_creation_with_no_calendar_capabilities()
test_quiz_has_grades() X-Ref |
No description |
test_quiz_format_grade() X-Ref |
No description |
test_quiz_get_grade_format() X-Ref |
No description |
test_quiz_format_question_grade() X-Ref |
No description |
test_quiz_delete_instance() X-Ref |
Test deleting a quiz instance. |
setup_quiz_for_testing_completion(array $completionoptions) X-Ref |
Setup function for all test_quiz_get_completion_state_* tests. param: array $completionoptions ['nbstudents'] => int, ['qtype'] => string, ['quizoptions'] => array return: array [$course, $students, $quiz, $cm] |
do_attempt_quiz($attemptoptions) X-Ref |
Helper function for all test_quiz_get_completion_state_* tests. Starts an attempt, processes responses and finishes the attempt. param: $attemptoptions ['quiz'] => object, ['student'] => object, ['tosubmit'] => array, ['attemptnumber'] => int |
test_quiz_get_completion_state_completionpass() X-Ref |
Test checking the completion state of a quiz. The quiz requires a passing grade to be completed. |
test_quiz_get_completion_state_completionexhausted() X-Ref |
Test checking the completion state of a quiz. To be completed, this quiz requires either a passing grade or for all attempts to be used up. |
test_quiz_get_completion_state_completionminattempts() X-Ref |
Test checking the completion state of a quiz. To be completed, this quiz requires a minimum number of attempts. |
test_quiz_get_completion_state_completionminattempts_pass() X-Ref |
Test checking the completion state of a quiz. To be completed, this quiz requires a minimum number of attempts AND a passing grade. This is somewhat of an edge case as it is hard to imagine a scenario in which these precise settings are useful. Nevertheless, this test makes sure these settings interact as intended. |
test_quiz_get_user_attempts() X-Ref |
No description |
test_quiz_get_group_override_priorities() X-Ref |
Test for quiz_get_group_override_priorities(). |
test_quiz_core_calendar_provide_event_action_open() X-Ref |
No description |
test_quiz_core_calendar_provide_event_action_open_for_user() X-Ref |
No description |
test_quiz_core_calendar_provide_event_action_closed() X-Ref |
No description |
test_quiz_core_calendar_provide_event_action_closed_for_user() X-Ref |
No description |
test_quiz_core_calendar_provide_event_action_open_in_future() X-Ref |
No description |
test_quiz_core_calendar_provide_event_action_open_in_future_for_user() X-Ref |
No description |
test_quiz_core_calendar_provide_event_action_no_capability() X-Ref |
No description |
test_quiz_core_calendar_provide_event_action_no_capability_for_user() X-Ref |
No description |
test_quiz_core_calendar_provide_event_action_already_finished() X-Ref |
No description |
test_quiz_core_calendar_provide_event_action_already_finished_for_user() X-Ref |
No description |
test_quiz_core_calendar_provide_event_action_already_completed() X-Ref |
No description |
test_quiz_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 quiz id. param: string $eventtype The event type. eg. QUIZ_EVENT_TYPE_OPEN. return: bool|calendar_event |
test_mod_quiz_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_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 a quiz. |