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 39 and 401] [Versions 401 and 402] [Versions 401 and 403]

(no description)

File Size: 1429 lines (59 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

settings_provider_test:: (47 methods):
  set_up_form_mocks()
  set_up_user_and_role()
  settings_capability_data_provider()
  test_setting_elements_are_part_of_quiz_settings_table()
  test_that_all_seb_settings_have_capabilities()
  test_setting_defaults_are_part_of_file_types()
  test_setting_types_are_part_of_file_types()
  assert_hide_if()
  test_hideifs()
  test_setting_hideifs_are_part_of_file_types()
  test_build_setting_capability_name_incorrect_setting()
  test_build_setting_capability_name_correct_setting()
  test_can_manage_seb_config_setting()
  test_get_requiresafeexambrowser_options()
  test_get_requiresafeexambrowser_options_with_conflicting_permissions()
  test_form_elements_are_frozen_if_conflicting_permissions()
  test_form_elements_are_locked_when_quiz_attempted_manual()
  test_form_elements_are_locked_when_quiz_attempted_template()
  test_showsebdownloadlink_in_form()
  test_allowedbrowserexamkeys_in_form()
  test_validate_draftarea_configfile_success()
  test_validate_draftarea_configfile_failure()
  test_get_current_user_draft_file()
  test_save_filemanager_sebconfigfile_draftarea()
  test_delete_uploaded_config_file()
  test_get_module_context_sebconfig_file()
  test_get_filemanager_options()
  test_can_configure_seb()
  test_can_use_seb_template()
  test_can_upload_seb_file()
  test_can_change_seb_showsebdownloadlink()
  test_can_change_seb_allowedbrowserexamkeys()
  test_can_configure_manually()
  test_is_seb_settings_locked()
  test_is_conflicting_permissions_for_manage_templates()
  test_is_conflicting_permissions_for_upload_seb_file()
  test_is_conflicting_permissions_for_configure_manually()
  test_add_prefix()
  test_filter_plugin_settings()
  get_settings()
  assert_filter_plugin_settings()
  test_filter_plugin_settings_for_no_seb()
  test_filter_plugin_settings_for_uploaded_config()
  test_filter_plugin_settings_for_template()
  test_filter_plugin_settings_for_client_config()
  test_filter_plugin_settings_for_configure_manually()
  test_get_seb_settings_map()


Class: settings_provider_test  - X-Ref

PHPUnit tests for settings_provider.

set_up_form_mocks()   X-Ref
Helper method to set up form mocks.


set_up_user_and_role()   X-Ref
Helper method to set up user and role for testing.


settings_capability_data_provider()   X-Ref
Capability data for testing.

return: array

test_setting_elements_are_part_of_quiz_settings_table()   X-Ref
Test that settings types to be added to quiz settings, are part of quiz_settings persistent class.


test_that_all_seb_settings_have_capabilities()   X-Ref
Make sure that all SEB settings have related capabilities.


test_setting_defaults_are_part_of_file_types()   X-Ref
Test that setting defaults only refer to settings defined in setting types.


test_setting_types_are_part_of_file_types()   X-Ref
Test that setting types only refer to settings defined in setting types.


assert_hide_if(hideif_rule $hideif, $element, $dependantname, $condition, $value)   X-Ref
Helper method to assert hide if element.

param: hideif_rule $hideif Rule to check.
param: string $element Expected element.
param: string $dependantname Expected dependant element name.
param: string $condition Expected condition.
param: mixed $value Expected value.

test_hideifs()   X-Ref
Test hideif rules.


test_setting_hideifs_are_part_of_file_types()   X-Ref
Test that setting hideif rules only refer to settings defined in setting types, including the conditions.


test_build_setting_capability_name_incorrect_setting()   X-Ref
Test that exception thrown if we try to build capability name from the incorrect setting name.


test_build_setting_capability_name_correct_setting()   X-Ref
Test we can build capability name from the the setting name.


test_can_manage_seb_config_setting()   X-Ref
Test can check if can manage SEB settings respecting settings structure.


test_get_requiresafeexambrowser_options($settingcapability)   X-Ref
Test SEB usage options.

param: string $settingcapability Setting capability to check manual option against.

test_get_requiresafeexambrowser_options_with_conflicting_permissions()   X-Ref
Test SEB usage options with conflicting permissions.


test_form_elements_are_frozen_if_conflicting_permissions()   X-Ref
Test that SEB options and templates are frozen if conflicting permissions.


test_form_elements_are_locked_when_quiz_attempted_manual()   X-Ref
Test that All settings are frozen if quiz was attempted and use seb with manual settings.


test_form_elements_are_locked_when_quiz_attempted_template()   X-Ref
Test that All settings are frozen if a quiz was attempted and use template.


test_showsebdownloadlink_in_form()   X-Ref
Test Show Safe Exam Browser download button setting in the form.


test_allowedbrowserexamkeys_in_form()   X-Ref
Test Allowed Browser Exam Keys setting in the form.


test_validate_draftarea_configfile_success()   X-Ref
Test the validation of a seb config file.


test_validate_draftarea_configfile_failure()   X-Ref
Test the validation of a missing seb config file.


test_get_current_user_draft_file()   X-Ref
Test obtaining the draftarea content.


test_save_filemanager_sebconfigfile_draftarea()   X-Ref
Test saving files from the user draft area into the quiz context area storage.


test_delete_uploaded_config_file()   X-Ref
Test deleting the $this->quiz->cmid itemid from the file area.


test_get_module_context_sebconfig_file()   X-Ref
Test getting the file from the context module id file area.


test_get_filemanager_options()   X-Ref
Test file manager options.


test_can_configure_seb()   X-Ref
Test that users can or can not configure seb settings.


test_can_use_seb_template()   X-Ref
Test that users can or can not use seb template.


test_can_upload_seb_file()   X-Ref
Test that users can or can not upload seb config file.


test_can_change_seb_showsebdownloadlink()   X-Ref
Test that users can or can not change Show Safe Exam Browser download button setting.


test_can_change_seb_allowedbrowserexamkeys()   X-Ref
Test that users can or can not change Allowed Browser Exam Keys setting.


test_can_configure_manually($settingcapability)   X-Ref
Test that users can or can not Configure SEb manually

param: string $settingcapability Setting capability to check manual option against.

test_is_seb_settings_locked()   X-Ref
Test that we can check if the seb settings are locked.


test_is_conflicting_permissions_for_manage_templates()   X-Ref
Test that we can check identify conflicting permissions if set to use template.


test_is_conflicting_permissions_for_upload_seb_file()   X-Ref
Test that we can check identify conflicting permissions if set to use own seb file.


test_is_conflicting_permissions_for_configure_manually($settingcapability)   X-Ref
Test that we can check identify conflicting permissions if set to use own configure manually.

param: string $settingcapability Setting capability to check manual option against.

test_add_prefix()   X-Ref
Test add_prefix helper method.


test_filter_plugin_settings()   X-Ref
Test filter_plugin_settings helper method.


get_settings()   X-Ref
Helper method to get a list of settings.

return: \stdClass

assert_filter_plugin_settings(int $type, array $notnulls)   X-Ref
Helper method to assert results of filter_plugin_settings

param: int $type Type of SEB usage.
param: array $notnulls A list of expected not null settings.

test_filter_plugin_settings_for_no_seb()   X-Ref
Test filter_plugin_settings method for no SEB case.


test_filter_plugin_settings_for_uploaded_config()   X-Ref
Test filter_plugin_settings method for using uploaded config.


test_filter_plugin_settings_for_template()   X-Ref
Test filter_plugin_settings method for using template.


test_filter_plugin_settings_for_client_config()   X-Ref
Test filter_plugin_settings method for using client config.


test_filter_plugin_settings_for_configure_manually()   X-Ref
Test filter_plugin_settings method for manually configured SEB.


test_get_seb_settings_map()   X-Ref
Test settings map.