function RedirectDestinationTest::providerGet

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php \Drupal\Tests\Core\Routing\RedirectDestinationTest::providerGet()
  2. 10 core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php \Drupal\Tests\Core\Routing\RedirectDestinationTest::providerGet()
  3. 11.x core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php \Drupal\Tests\Core\Routing\RedirectDestinationTest::providerGet()

File

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

Class

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

Namespace

Drupal\Tests\Core\Routing

Code

public function providerGet() {
    $data = [];
    $request = Request::create('/');
    $request->query
        ->set('destination', '/example');
    // A request with a destination query.
    $data[] = [
        $request,
        '/example',
    ];
    // A request without a destination query,
    $request = Request::create('/');
    $data[] = [
        $request,
        '/current-path',
    ];
    // A request without destination query, but other query attributes.
    $request = Request::create('/');
    $request->query
        ->set('other', 'value');
    $data[] = [
        $request,
        '/current-path?other=value',
    ];
    // A request with a dedicated specified external destination.
    $request = Request::create('/');
    $request->query
        ->set('destination', 'https://www.drupal.org');
    $data[] = [
        $request,
        '/',
    ];
    return $data;
}

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