You are here

public function DisplayAccessDeniedMessageTest::testDisplayAccessDeniedMessage in Redirect 403 to User Login 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/DisplayAccessDeniedMessageTest.php \Drupal\Tests\r4032login\Functional\DisplayAccessDeniedMessageTest::testDisplayAccessDeniedMessage()

Test activation and deactivation of the "User login access denied" message.

Throws

\Behat\Mink\Exception\ExpectationException

File

tests/src/Functional/DisplayAccessDeniedMessageTest.php, line 24

Class

DisplayAccessDeniedMessageTest
Test that it is possible to change the "User login access denied" message.

Namespace

Drupal\Tests\r4032login\Functional

Code

public function testDisplayAccessDeniedMessage() {
  $config = $this
    ->config('r4032login.settings');
  $config
    ->set('display_denied_message', TRUE);
  $config
    ->save();
  $this
    ->drupalGet('admin/config');
  $this
    ->assertSession()
    ->elementTextContains('css', '.messages', 'Access denied. You must log in to view this page.');
  $config = $this
    ->config('r4032login.settings');
  $config
    ->set('display_denied_message', FALSE);
  $config
    ->save();
  $this
    ->drupalGet('admin/config');
  $this
    ->assertSession()
    ->elementNotExists('css', '.messages');
}