Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
test_helper_trait.php File Reference

Functions

 assign_user_capability ($capability, $contextid, $roleid=null)
 Assign a capability to $USER The function creates a student $USER if $USER->id is empty.
 
 attempt_quiz ($quiz, $user)
 Answer questions for a quiz + user.
 
 create_module_test_file (string $xml, string $cmid)
 Create a file in a modules filearea.
 
 create_template (string $xml=null)
 Create test template.
 
 create_test_draftarea_file (string $xml)
 Creates a file in the user draft area.
 
 create_test_quiz ($course, $requiresafeexambrowser=settings_provider::USE_SEB_NO)
 Create a test quiz for the specified course.
 
 get_access_manager ()
 Get access manager for testing.
 
 get_test_settings (array $settings=[])
 Get a test object containing mock test settings.
 
 make_rule ()
 A helper method to make the rule form the currently created quiz and course.
 
 set_up_quiz_view_page ()
 A helper method to set up quiz view page.
 
 strip_all_prefixes (\stdClass $settings)
 Strip the seb_ prefix from each setting key.
 

Variables

global $CFG
 
stdClass $quiz
 $quiz A test quiz.
 
stdClass $user
 $user A test logged-in user.
 
trait quizaccess_seb_test_helper_trait
 A test helper trait.