Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]
A collection of tests for accesslib::has_capability().
Copyright: | 2018 Andrew Nicols <andrew@nicols.co.uk> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 700 lines (30 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
accesslib_has_capability_test:: (7 methods):
test_locked_contexts()
test_locked_contexts_for_admin_with_config()
locked_context_provider()
login_as_provider()
test_login_as_admin()
test_login_as_user()
get_test_data()
Class: accesslib_has_capability_test - X-Ref
Unit tests tests for has_capability.test_locked_contexts($lockedcontexts, $blocked) X-Ref |
Unit tests to check the operation of locked contexts. Note: We only check the admin user here. If the admin cannot do it, then no-one can. param: string[] $lockedcontexts The list of contexts, by name, to mark as locked param: string[] $blocked The list of contexts which will be 'blocked' by has_capability |
test_locked_contexts_for_admin_with_config($lockedcontexts, $blocked) X-Ref |
Unit tests to check the operation of locked contexts. Note: We only check the admin user here. If the admin cannot do it, then no-one can. param: string[] $lockedcontexts The list of contexts, by name, to mark as locked param: string[] $blocked The list of contexts which will be 'blocked' by has_capability |
locked_context_provider() X-Ref |
Data provider for testing that has_capability() deals with locked contexts. return: array |
login_as_provider() X-Ref |
Data provider for for has_capability tests when logged in as a different user. return: array |
test_login_as_admin(string $loginascontext, array $testcontexts) X-Ref |
Test that the log in as functionality works as expected for an administrator. An administrator logged in as another user assumes all of their capabilities. param: string $loginascontext param: array $testcontexts |
test_login_as_user(string $loginascontext, array $testcontexts) X-Ref |
Test that the log in as functionality works as expected for a regulr user. param: string $loginascontext param: array $testcontexts |
get_test_data() X-Ref |
Get the test data contexts. return: stdClass |