public function RestrictIpAccessTest::testWhitelistedPaths in Restrict IP 8.2
Same name and namespace in other branches
- 8 tests/src/Functional/RestrictIpAccessTest.php \Drupal\Tests\restrict_ip\Functional\RestrictIpAccessTest::testWhitelistedPaths()
- 3.x tests/src/Functional/RestrictIpAccessTest.php \Drupal\Tests\restrict_ip\Functional\RestrictIpAccessTest::testWhitelistedPaths()
File
- tests/
src/ Functional/ RestrictIpAccessTest.php, line 125
Class
- RestrictIpAccessTest
- @group restrict_ip
Namespace
Drupal\Tests\restrict_ip\FunctionalCode
public function testWhitelistedPaths() {
$adminUser = $this
->drupalCreateUser([
'administer restricted ip addresses',
'access administration pages',
'administer modules',
]);
$this
->drupalLogin($adminUser);
$this
->createArticleContentType();
$this
->createArticle();
$this
->createArticle();
$this
->drupalGet('admin/config/people/restrict_ip');
$this
->assertStatusCodeEquals(200);
$this
->checkCheckbox('#edit-enable');
$this
->selectRadio('#edit-white-black-list-1');
$this
->fillTextValue('edit-page-whitelist', 'node/1');
$this
->click('#edit-submit');
$this
->drupalGet('node/1');
$this
->assertSession()
->pageTextNotContains('The page you are trying to access cannot be accessed from your IP address.');
$this
->drupalGet('node/2');
$this
->assertSession()
->pageTextContains('The page you are trying to access cannot be accessed from your IP address.');
}