Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 402] [Versions 400 and 403]
A test helper trait.
Author: | Andrew Madden <andrewmadden@catalyst-au.net> |
Copyright: | 2019 Catalyst IT |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 309 lines (10 kb) |
Included or required: | 8 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
assign_user_capability($capability, $contextid, $roleid = null) X-Ref |
Assign a capability to $USER The function creates a student $USER if $USER->id is empty return: int The role id - mainly returned for creation, so calling function can reuse it. param: string $capability Capability name. param: int $contextid Context ID. param: int $roleid Role ID. |
strip_all_prefixes(\stdClass $settings) X-Ref |
Strip the seb_ prefix from each setting key. return: \stdClass The modified settings object. param: \stdClass $settings Object containing settings. |
create_test_draftarea_file(string $xml) X-Ref |
Creates a file in the user draft area. return: int The user draftarea id param: string $xml |
create_module_test_file(string $xml, string $cmid) X-Ref |
Create a file in a modules filearea. return: int Item ID of file. param: string $xml XML content of the file. param: string $cmid Course module id. |
create_test_quiz($course, $requiresafeexambrowser = settings_provider::USE_SEB_NO) X-Ref |
Create a test quiz for the specified course. return: array param: \stdClass $course param: int $requiresafeexambrowser How to use SEB for this quiz? |
attempt_quiz($quiz, $user) X-Ref |
Answer questions for a quiz + user. return: array param: \stdClass $quiz Quiz to attempt. param: \stdClass $user A user to attempt the quiz. |
create_template(string $xml = null) X-Ref |
Create test template. return: \quizaccess_seb\template Just created template. param: string|null $xml Template content. |
get_access_manager() X-Ref |
Get access manager for testing. return: \quizaccess_seb\access_manager |
make_rule() X-Ref |
A helper method to make the rule form the currently created quiz and course. return: \quiz_access_rule_base|null |
set_up_quiz_view_page() X-Ref |
A helper method to set up quiz view page. |
get_test_settings(array $settings = []) X-Ref |
Get a test object containing mock test settings. return: \stdClass Settings. |