public function RestrictIpAccessTest::testIpWhitelist in Restrict IP 8.2
Same name and namespace in other branches
- 8 tests/src/Functional/RestrictIpAccessTest.php \Drupal\Tests\restrict_ip\Functional\RestrictIpAccessTest::testIpWhitelist()
- 3.x tests/src/Functional/RestrictIpAccessTest.php \Drupal\Tests\restrict_ip\Functional\RestrictIpAccessTest::testIpWhitelist()
* Test that a user is not blocked if their IP address is whitelisted when the module is enabled
File
- tests/
src/ Functional/ RestrictIpAccessTest.php, line 35
Class
- RestrictIpAccessTest
- @group restrict_ip
Namespace
Drupal\Tests\restrict_ip\FunctionalCode
public function testIpWhitelist() {
$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
->fillTextValue('edit-address-list', $_SERVER['REMOTE_ADDR'] . PHP_EOL . '::1');
$this
->click('#edit-submit');
$this
->assertSession()
->pageTextNotContains('The page you are trying to access cannot be accessed from your IP address.');
return $adminUser;
}