Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

(no description)

File Size: 444 lines (18 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: access_manager_test  - X-Ref

PHPUnit tests for the access manager.

setUp()   X-Ref
Called before every test.


test_access_manager_quizsettings_null()   X-Ref
Test access_manager private property quizsettings is null.


test_seb_required_false()   X-Ref
Test that SEB is not required.


test_seb_required_true()   X-Ref
Test that SEB is required.


test_user_can_bypass_seb_check()   X-Ref
Test that user has capability to bypass SEB check.


test_user_cannot_bypass_seb_check()   X-Ref
Test user does not have capability to bypass SEB check.


test_is_using_seb()   X-Ref
Test we can detect SEB usage.


test_access_keys_validate_with_config_key()   X-Ref
Test that the quiz Config Key matches the incoming request header.


test_access_keys_fail_to_validate_with_config_key()   X-Ref
Test that the quiz Config Key does not match the incoming request header.


test_config_key_not_checked_if_client_requirement_is_selected()   X-Ref
Test that config key is not checked when using client configuration with SEB.


test_no_browser_exam_keys_cause_check_to_be_skipped()   X-Ref
Test that if there are no browser exam keys for quiz, check is skipped.


test_access_keys_fail_if_browser_exam_key_header_does_not_exist()   X-Ref
Test that access fails if there is no hash in header.


test_access_keys_fail_if_browser_exam_key_header_does_not_match_provided_hash()   X-Ref
Test that access fails if browser exam key doesn't match hash in header.


test_browser_exam_keys_match_header_hash()   X-Ref
Test that browser exam key matches hash in header.


test_get_received_config_key()   X-Ref
Test can get received config key.


get_received_browser_exam_key()   X-Ref
Test can get received browser key.


test_get_seb_use_type()   X-Ref
Test can correctly get type of SEB usage for the quiz.


should_validate_basic_header_data_provider()   X-Ref
Data provider for self::test_should_validate_basic_header.

return: array

test_should_validate_basic_header($type, $expected)   X-Ref
Test we know when we should validate basic header.

param: int $type Type of SEB usage.
param: bool $expected Expected result.

should_validate_config_key_data_provider()   X-Ref
Data provider for self::test_should_validate_config_key.

return: array

test_should_validate_config_key($type, $expected)   X-Ref
Test we know when we should validate config key.

param: int $type Type of SEB usage.
param: bool $expected Expected result.

should_validate_browser_exam_key_data_provider()   X-Ref
Data provider for self::test_should_validate_browser_exam_key.

return: array

test_should_validate_browser_exam_key($type, $expected)   X-Ref
Test we know when we should browser exam key.

param: int $type Type of SEB usage.
param: bool $expected Expected result.

test_access_manager_uses_cached_config_key()   X-Ref
Test that access manager uses cached Config Key.


test_valid_config_key_is_null_if_no_settings()   X-Ref
Check that valid SEB config key is null if quiz doesn't have SEB settings.