public function SessionLimitLogoutTestCase::testSessionLimitRoles in Session Limit 7.2
Same name and namespace in other branches
- 8 tests/session_limit.test \SessionLimitLogoutTestCase::testSessionLimitRoles()
- 6.2 tests/session_limit.test \SessionLimitLogoutTestCase::testSessionLimitRoles()
- 2.x tests/session_limit.test \SessionLimitLogoutTestCase::testSessionLimitRoles()
Checks that the session limit is returned correctly by a role.
File
- tests/
session_limit.test, line 428 - Simpletest tests for session_limit.
Class
- SessionLimitLogoutTestCase
- Session limit functions when expected behaviour is to logout oldest session.
Code
public function testSessionLimitRoles() {
// Create a test user.
$user = $this
->drupalCreateUser(array(
'access content',
));
$roles = $this
->sessionLimitMakeRoles($user);
// Set the session limits for the roles.
variable_set('session_limit_rid_' . $roles[0]->rid, 2);
variable_set('session_limit_rid_' . $roles[1]->rid, 4);
variable_set('session_limit_rid_' . $roles[2]->rid, 3);
// Set the default session limit.
variable_set('session_limit_max', 1);
// Check if the user has access to 4 sessions.
$this
->assertSessionLogout(4, $user);
}