TfaConfigTest.php in Two-factor Authentication (TFA) 8
File
tests/src/Functional/TfaConfigTest.php
View source
<?php
namespace Drupal\Tests\tfa\Functional;
class TfaConfigTest extends TfaTestBase {
protected $webUser;
protected $adminUser;
protected static $modules = [
'tfa_test_plugins',
'tfa',
'encrypt',
'encrypt_test',
'key',
];
public function setUp() : void {
parent::setUp();
$this->webUser = $this
->drupalCreateUser([
'setup own tfa',
]);
$this->adminUser = $this
->drupalCreateUser([
'admin tfa settings',
]);
}
public function testTfaConfigFormAccess() {
$assert = $this
->assertSession();
$this
->drupalLogin($this->webUser);
$this
->drupalGet('admin/config/people/tfa');
$assert
->statusCodeEquals(403);
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/config/people/tfa');
$assert
->statusCodeEquals(200);
}
public function testTfaConfigForm() {
$this
->canEnableValidationPlugin('tfa_test_plugins_validation');
}
}