You are here

private function RedirectTest::assertRedirected in Restrict Login or Role Access by IP Address 8.4

4 calls to RedirectTest::assertRedirected()
RedirectTest::testIpDifferGlobalNoDestination in src/Tests/RedirectTest.php
RedirectTest::testIpDifferGlobalWithDestination in src/Tests/RedirectTest.php
RedirectTest::testIpDifferUserNoDestination in src/Tests/RedirectTest.php
RedirectTest::testIpDifferUserWithDestination in src/Tests/RedirectTest.php

File

src/Tests/RedirectTest.php, line 61

Class

RedirectTest
Tests user is redirected when login denied.

Namespace

Drupal\restrict_by_ip\Tests

Code

private function assertRedirected($destination = NULL) {
  $edit = [
    'name' => $this->regularUser
      ->label(),
    'pass' => $this->regularUser->pass_raw,
  ];
  $options = [
    'external' => FALSE,
  ];
  if (isset($destination)) {
    $options['query'] = [
      'destination' => $destination,
    ];
  }
  $this
    ->drupalPostForm('user/login', $edit, t('Log in'), $options);
  $this
    ->assertFalse($this
    ->drupalUserIsLoggedIn($this->regularUser), t('User %name unsuccessfully logged in.', [
    '%name' => $this->regularUser
      ->label(),
  ]));
  $this
    ->assertText($this->loginDeniedNode
    ->label(), 'Title of login denied page found.');
}