public function RestrictIpAccessTest::testRedirectToLoginWhenBypassByRoleEnabled in Restrict IP 3.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/RestrictIpAccessTest.php \Drupal\Tests\restrict_ip\Functional\RestrictIpAccessTest::testRedirectToLoginWhenBypassByRoleEnabled()
- 8 tests/src/Functional/RestrictIpAccessTest.php \Drupal\Tests\restrict_ip\Functional\RestrictIpAccessTest::testRedirectToLoginWhenBypassByRoleEnabled()
File
- tests/
src/ Functional/ RestrictIpAccessTest.php, line 100
Class
- RestrictIpAccessTest
- @group restrict_ip
Namespace
Drupal\Tests\restrict_ip\FunctionalCode
public function testRedirectToLoginWhenBypassByRoleEnabled() {
$adminUser = $this
->drupalCreateUser([
'administer restricted ip addresses',
'access administration pages',
'administer modules',
]);
$this
->createArticleContentType();
$this
->createArticle();
$this
->drupalLogin($adminUser);
$this
->drupalGet('admin/config/people/restrict_ip');
$this
->assertStatusCodeEquals(200);
$this
->checkCheckbox('#edit-allow-role-bypass');
$this
->selectRadio('#edit-bypass-action-redirect-login-page');
$this
->click('#edit-submit');
$admin_role = $this
->createRole([
'bypass ip restriction',
]);
$adminUser
->addRole($admin_role);
$this
->checkCheckbox('#edit-enable');
$this
->click('#edit-submit');
$this
->drupalLogout();
$this
->drupalGet('node/1');
$this
->assertElementExists('#edit-name');
}