You are here

public function CaptchaAdminTest::testAdminAccess in CAPTCHA 8

Test access to the admin pages.

File

tests/src/Functional/CaptchaAdminTest.php, line 21

Class

CaptchaAdminTest
Tests CAPTCHA admin settings.

Namespace

Drupal\Tests\captcha\Functional

Code

public function testAdminAccess() {
  $this
    ->drupalLogin($this->normalUser);
  $this
    ->drupalGet(self::CAPTCHA_ADMIN_PATH);
  $this
    ->assertSession()
    ->pageTextContains($this
    ->t('Access denied'), 'Normal users should not be able to access the CAPTCHA admin pages', 'CAPTCHA');
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet(self::CAPTCHA_ADMIN_PATH);
  $this
    ->assertSession()
    ->pageTextNotContains($this
    ->t('Access denied'), 'Admin users should be able to access the CAPTCHA admin pages', 'CAPTCHA');
}