You are here

public function RedirectToDestinationTest::testRedirectToDestination in Redirect 403 to User Login 8

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

Tests the behavior of the redirect_to_destination option.

@dataProvider redirectToDestinationDataProvider

Parameters

bool $optionValue: The option value for "redirect_to_destination".

string $path: Request path.

string $destination: Resulting URL.

File

tests/src/Functional/RedirectToDestinationTest.php, line 31

Class

RedirectToDestinationTest
Test the option "Redirect user to the page they tried to access after login".

Namespace

Drupal\Tests\r4032login\Functional

Code

public function testRedirectToDestination($optionValue, $path, $destination) {
  $config = $this
    ->config('r4032login.settings');
  $config
    ->set('redirect_to_destination', $optionValue);
  $config
    ->save();
  $this
    ->drupalGet($path);
  $currentUrl = str_replace($this->baseUrl . '/', '', $this
    ->getUrl());
  $this
    ->assertEquals($currentUrl, $destination);
}