function RedirectDestinationTest::testGet

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php \Drupal\Tests\Core\Routing\RedirectDestinationTest::testGet()
  2. 8.9.x core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php \Drupal\Tests\Core\Routing\RedirectDestinationTest::testGet()
  3. 11.x 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 76

Class

RedirectDestinationTest
@coversDefaultClass \Drupal\Core\Routing\RedirectDestination[[api-linebreak]] @group Routing

Namespace

Drupal\Tests\Core\Routing

Code

public function testGet(Request $request, $expected_destination) : void {
  $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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.