You are here

public function RedirectDestinationTest::testGet in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php \Drupal\Tests\Core\Routing\RedirectDestinationTest::testGet()
  2. 9 core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php \Drupal\Tests\Core\Routing\RedirectDestinationTest::testGet()

Tests destination passed via $_GET.

@dataProvider providerGet

@covers ::get

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request to test.

string $expected_destination: The expected destination.

File

core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php, line 74

Class

RedirectDestinationTest
@coversDefaultClass \Drupal\Core\Routing\RedirectDestination @group Routing

Namespace

Drupal\Tests\Core\Routing

Code

public function testGet(Request $request, $expected_destination) {
  $this->requestStack
    ->push($request);
  $this
    ->setupUrlGenerator();

  // Call in twice in order to ensure it returns the same the next time.
  $this
    ->assertEquals($expected_destination, $this->redirectDestination
    ->get());
  $this
    ->assertEquals($expected_destination, $this->redirectDestination
    ->get());
}