You are here

public function AuthenticatedRedirectTest::testAuthenticatedRedirect in Redirect 403 to User Login 8

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

Test the redirection behavior for authenticated user.

@dataProvider baseRedirectDataProvider

Parameters

string $optionValue: The option value for "Redirect authenticated users to" option.

string $path: Request path.

int $code: Response status code.

string $destination: Resulting URL.

Throws

\Behat\Mink\Exception\ExpectationException

File

tests/src/Functional/AuthenticatedRedirectTest.php, line 51

Class

AuthenticatedRedirectTest
Test authenticated redirection from 403 to configured page.

Namespace

Drupal\Tests\r4032login\Functional

Code

public function testAuthenticatedRedirect($optionValue, $path, $code, $destination) {
  $config = $this
    ->config('r4032login.settings');
  $config
    ->set('redirect_authenticated_users_to', $optionValue);
  $config
    ->save();
  $this
    ->drupalLogin($this->webUser);
  $this
    ->drupalGet($path);
  $this
    ->assertSession()
    ->statusCodeEquals($code);
  $this
    ->assertSession()
    ->addressEquals($destination);
}