Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

(no description)

File Size: 850 lines (45 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 mod/quiz/accessrule/seb/tests/test_helper_trait.php

Defines 1 class


Class: quiz_settings_test  - X-Ref

PHPUnit tests for quiz_settings class.

setUp()   X-Ref
Called before every test.


test_config_is_created_from_quiz_settings()   X-Ref
Test that config is generated immediately prior to saving quiz settings.


test_config_is_updated_from_quiz_settings()   X-Ref
Test that config string gets updated from quiz settings.


test_config_key_is_created_from_quiz_settings()   X-Ref
Test that config key is generated immediately prior to saving quiz settings.


test_config_key_is_updated_from_quiz_settings()   X-Ref
Test that config key is generated immediately prior to saving quiz settings.


test_filter_rules_added_to_config(\stdClass $settings, string $expectedxml)   X-Ref
Test that different URL filter expressions are turned into config XML.

param: \stdClass $settings Quiz settings
param: string $expectedxml SEB Config XML.

test_browser_exam_keys_are_retrieved_as_array()   X-Ref
Test that browser keys are validated and retrieved as an array instead of string.


test_browser_exam_keys_validation_errors($bek, $expectederrorstring)   X-Ref
Test validation of Browser Exam Keys.

param: string $bek Browser Exam Key.
param: string $expectederrorstring Expected error.

test_config_file_uploaded_converted_to_config()   X-Ref
Test that uploaded seb file gets converted to config string.


test_no_config_file_uploaded()   X-Ref
Test test_no_config_file_uploaded


get_config_xml($allowuserquitseb = null, $quitpassword = null)   X-Ref
A helper function to build a config file.

param: mixed $allowuserquitseb Required allowQuit setting.
param: mixed $quitpassword Required hashedQuitPassword setting.
return: string

test_using_seb_template_override_settings_when_they_set_in_template()   X-Ref
Test using USE_SEB_TEMPLATE and have it override settings from the template when they are set.


test_using_seb_template_override_settings_when_not_set_in_template()   X-Ref
Test using USE_SEB_TEMPLATE and have it override settings from the template when they are not set.


test_using_own_config_settings_are_not_overridden_if_set()   X-Ref
Test using USE_SEB_UPLOAD_CONFIG and use settings from the file if they are set.


test_using_own_config_settings_are_not_overridden_if_not_set()   X-Ref
Test using USE_SEB_UPLOAD_CONFIG and use settings from the file if they are not set.


test_template_has_quit_url_set()   X-Ref
Test using USE_SEB_TEMPLATE populates the linkquitseb setting if a quitURL is found.


test_config_file_uploaded_has_quit_url_set()   X-Ref
Test using USE_SEB_UPLOAD_CONFIG populates the linkquitseb setting if a quitURL is found.


test_templateid_set_correctly_when_save_settings()   X-Ref
Test template id set correctly.


save_settings_with_optional_template($quizsettings, $savetype, $templateid = 0)   X-Ref
Helper function in tests to set USE_SEB_TEMPLATE and a template id on the quiz settings.

param: quiz_settings $quizsettings Given quiz settings instance.
param: int $savetype Type of SEB usage.
param: int $templateid Template ID.

bad_browser_exam_key_provider()   X-Ref
Bad browser exam key data provider.

return: array

filter_rules_provider()   X-Ref
Provide settings for different filter rules.

return: array Test data.

test_generates_config_values_as_null_when_expected()   X-Ref
Test that config and config key are null when expected.


test_quizsettings_cache_exists_after_creation()   X-Ref
Test that quizsettings cache exists after creation.


test_quizsettings_cache_purged_after_deletion()   X-Ref
Test that quizsettings cache gets deleted after deletion.


test_get_quiz_settings_by_quiz_id()   X-Ref
Test that we can get quiz_settings by quiz id.


test_config_cache_exists_after_creation()   X-Ref
Test that SEB config cache exists after creation of the quiz.


test_config_cache_purged_after_deletion()   X-Ref
Test that SEB config cache gets deleted after deletion.


test_get_config_by_quiz_id()   X-Ref
Test that we can get SEB config by quiz id.


test_config_key_cache_exists_after_creation()   X-Ref
Test that SEB config key cache exists after creation of the quiz.


test_config_key_cache_purged_after_deletion()   X-Ref
Test that SEB config key cache gets deleted after deletion.


test_get_config_key_by_quiz_id()   X-Ref
Test that we can get SEB config key by quiz id.