You are here

public function SessionLimitPreventTestCase::testSessionPreventOnMax2 in Session Limit 2.x

Same name in this branch
  1. 2.x tests/session_limit.test \SessionLimitPreventTestCase::testSessionPreventOnMax2()
  2. 2.x tests/SessionLimitPreventTestCase.php \Drupal\session_limit\SessionLimitPreventTestCase::testSessionPreventOnMax2()
Same name and namespace in other branches
  1. 8 tests/session_limit.test \SessionLimitPreventTestCase::testSessionPreventOnMax2()
  2. 6.2 tests/session_limit.test \SessionLimitPreventTestCase::testSessionPreventOnMax2()
  3. 7.2 tests/session_limit.test \SessionLimitPreventTestCase::testSessionPreventOnMax2()

Test user can only have 2 sessions, prevent new sessions.

File

tests/session_limit.test, line 581
Simpletest tests for session_limit.

Class

SessionLimitPreventTestCase
Session limit functionality when behaviour is to prevent login at limit.

Code

public function testSessionPreventOnMax2() {

  // Set the default session limit.
  \Drupal::configFactory()
    ->getEditable('session_limit.settings')
    ->set('session_limit_max', 1)
    ->save();
  $this
    ->assertSessionPrevent(2);
  $this
    ->closeAllSessions();
}