public function AutologoutTestCase::testAutlogoutOfAdminPages in Automated Logout 6.4
Same name and namespace in other branches
- 7.4 tests/autologout.test \AutologoutTestCase::testAutlogoutOfAdminPages()
Test enforce logout on admin page settings.
File
- tests/
autologout.test, line 208 - Simpletest tests for autologout.
Class
- AutologoutTestCase
- Tests the autologout's features.
Code
public function testAutlogoutOfAdminPages() {
// Set an admin page path.
$_GET['q'] = 'admin';
// Check if user will be kept logged in on admin paths with enforce dsabled.
variable_set('autologout_enforce_admin', FALSE);
$this
->assertEqual(autologout_autologout_refresh_only(), TRUE, t('Autologout does logout of admin pages without enforce on admin checked.'));
// Check if user will not be kept logged in on admin paths if
// enforce enabled.
variable_set('autologout_enforce_admin', TRUE);
$this
->assertEqual(autologout_autologout_refresh_only(), FALSE, t('Autologout does not logout of admin pages with enforce on admin not checked.'));
// Set a non admin page path.
$_GET['q'] = 'node';
variable_set('autologout_enforce_admin', FALSE);
$this
->assertEqual(autologout_autologout_refresh_only(), FALSE, t('autologout_autologout_refresh_only() returns FALSE on non admin page when enforce is disabled.'));
variable_set('autologout_enforce_admin', TRUE);
$this
->assertEqual(autologout_autologout_refresh_only(), FALSE, t('autologout_autologout_refresh_only() returns FALSE on non admin page when enforce is enabled.'));
// Check behaviour of autologout on node edit pages depending
// on their admin page status.
variable_set('node_admin_theme', '0');
$_GET['q'] = 'node/add/page';
// Check if user will be logged out of node edit pages if they
// are not considered admin pages.
variable_set('autologout_enforce_admin', FALSE);
$this
->assertEqual(autologout_autologout_refresh_only(), FALSE, t('autologout_autologout_refresh_only() returns FALSE on node edit pages when they are not considered admin pages.'));
variable_set('autologout_enforce_admin', TRUE);
$this
->assertEqual(autologout_autologout_refresh_only(), FALSE, t('autologout_autologout_refresh_only() returns FALSE on node edit pages when they are not considered admin pages.'));
// Consider node edit pages as admin pages.
variable_set('node_admin_theme', '1');
$_GET['q'] = 'node/add/page';
// Check if user will be kept logged into node edit pages if they
// are considered admin when enforce is disabled.
variable_set('autologout_enforce_admin', FALSE);
$this
->assertEqual(autologout_autologout_refresh_only(), TRUE, t('User will be kept logged into node edit pages if they are considered admin when enforce is disabled.'));
// Check if user will not be kept logged into node edit pages if
// they are considered admin wehn enforce is enabled.
variable_set('autologout_enforce_admin', TRUE);
$this
->assertEqual(autologout_autologout_refresh_only(), FALSE, t('User will not be kept logged into node edit pages if they are considered admin when enforce is enabled.'));
}