You are here

public function RestrictIpAccessTest::testModuleEnabled in Restrict IP 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/RestrictIpAccessTest.php \Drupal\Tests\restrict_ip\Functional\RestrictIpAccessTest::testModuleEnabled()
  2. 3.x tests/src/Functional/RestrictIpAccessTest.php \Drupal\Tests\restrict_ip\Functional\RestrictIpAccessTest::testModuleEnabled()

* Test that a user is blocked when the module is enabled

File

tests/src/Functional/RestrictIpAccessTest.php, line 20

Class

RestrictIpAccessTest
@group restrict_ip

Namespace

Drupal\Tests\restrict_ip\Functional

Code

public function testModuleEnabled() {
  $adminUser = $this
    ->drupalCreateUser([
    'administer restricted ip addresses',
    'access administration pages',
    'administer modules',
  ]);
  $this
    ->drupalLogin($adminUser);
  $this
    ->drupalGet('admin/config/people/restrict_ip');
  $this
    ->assertStatusCodeEquals(200);
  $this
    ->checkCheckbox('#edit-enable');
  $this
    ->click('#edit-submit');
  $this
    ->assertSession()
    ->pageTextContains('The page you are trying to access cannot be accessed from your IP address.');
}