function RedirectDestinationTest::setupUrlGenerator

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php \Drupal\Tests\Core\Routing\RedirectDestinationTest::setupUrlGenerator()
  2. 9 core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php \Drupal\Tests\Core\Routing\RedirectDestinationTest::setupUrlGenerator()
  3. 8.9.x core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php \Drupal\Tests\Core\Routing\RedirectDestinationTest::setupUrlGenerator()
  4. main core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php \Drupal\Tests\Core\Routing\RedirectDestinationTest::setupUrlGenerator()
3 calls to RedirectDestinationTest::setupUrlGenerator()
RedirectDestinationTest::testGet in core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php
Tests destination passed via $_GET.
RedirectDestinationTest::testGetAsArray in core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php
@dataProvider providerGet
RedirectDestinationTest::testSetAfterGetCall in core/tests/Drupal/Tests/Core/Routing/RedirectDestinationTest.php
@covers ::set[[api-linebreak]] @covers ::get[[api-linebreak]]

File

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

Class

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

Namespace

Drupal\Tests\Core\Routing

Code

protected function setupUrlGenerator() {
  $this->urlGenerator
    ->expects($this->any())
    ->method('generateFromRoute')
    ->willReturnCallback(function ($route, $parameters, $options) {
    $query_string = '';
    if (!empty($options['query'])) {
      $query_string = '?' . UrlHelper::buildQuery($options['query']);
    }
    return '/current-path' . $query_string;
  });
}

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