public function SettingsFormTest::testAccess in Login And Logout Redirect Per Role 8
Test access to the settings form.
File
- tests/
src/ Functional/ SettingsFormTest.php, line 189
Class
- SettingsFormTest
- Tests the Redirect URL settings form.
Namespace
Drupal\Tests\login_redirect_per_role\FunctionalCode
public function testAccess() {
// An anonymous user doens't have the right permission to access the
// settings form.
$this
->drupalGet(Url::fromRoute('login_redirect_per_role.redirect_url_admin_settings'));
$this
->assertSession()
->statusCodeEquals(403);
// Login as a regular user.
$this
->drupalLogin($this->webUser);
// The web user doens't have the 'administer site configuration' permission.
$this
->drupalGet(Url::fromRoute('login_redirect_per_role.redirect_url_admin_settings'));
$this
->assertSession()
->statusCodeEquals(403);
// Login as an admin user.
$this
->drupalLogin($this->adminUser);
// The admin user has the 'administer site configuration' permission.
$this
->drupalGet(Url::fromRoute('login_redirect_per_role.redirect_url_admin_settings'));
$this
->assertSession()
->statusCodeEquals(200);
}