You are here

public function TfaConfigTest::testTfaConfigFormAccess in Two-factor Authentication (TFA) 8

Test the access to the configuration form based on module permissions.

File

tests/src/Functional/TfaConfigTest.php, line 49

Class

TfaConfigTest
Tests the Tfa UI.

Namespace

Drupal\Tests\tfa\Functional

Code

public function testTfaConfigFormAccess() {
  $assert = $this
    ->assertSession();

  // Check that config form is restricted for users.
  $this
    ->drupalLogin($this->webUser);
  $this
    ->drupalGet('admin/config/people/tfa');
  $assert
    ->statusCodeEquals(403);

  // Check that config form is accessible to admins.
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/config/people/tfa');
  $assert
    ->statusCodeEquals(200);
}