function RedirectResponseSubscriberTest::providerTestDestinationRedirectToExternalUrl

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php \Drupal\Tests\Core\EventSubscriber\RedirectResponseSubscriberTest::providerTestDestinationRedirectToExternalUrl()
  2. 10 core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php \Drupal\Tests\Core\EventSubscriber\RedirectResponseSubscriberTest::providerTestDestinationRedirectToExternalUrl()
  3. 11.x core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php \Drupal\Tests\Core\EventSubscriber\RedirectResponseSubscriberTest::providerTestDestinationRedirectToExternalUrl()

Data provider for testDestinationRedirectToExternalUrl().

File

core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php, line 152

Class

RedirectResponseSubscriberTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21EventSubscriber%21RedirectResponseSubscriber.php/class/RedirectResponseSubscriber/9" title="Allows manipulation of the response object when performing a redirect." class="local">\Drupal\Core\EventSubscriber\RedirectResponseSubscriber</a> @group EventSubscriber

Namespace

Drupal\Tests\Core\EventSubscriber

Code

public function providerTestDestinationRedirectToExternalUrl() {
    return [
        'absolute external url' => [
            new Request([
                'destination' => 'http://example.com',
            ]),
            'http://example.com',
        ],
        'absolute external url with folder' => [
            new Request([
                'destination' => 'http://example.com/foobar',
            ]),
            'http://example.com/foobar',
        ],
        'absolute external url with folder2' => [
            new Request([
                'destination' => 'http://example.ca/drupal',
            ]),
            'http://example.ca/drupal',
        ],
        'path without drupal basepath' => [
            new Request([
                'destination' => '/test',
            ]),
            'http://example.com/test',
        ],
        'path with URL' => [
            new Request([
                'destination' => '/example.com',
            ]),
            'http://example.com/example.com',
        ],
        'path with URL and two slashes' => [
            new Request([
                'destination' => '//example.com',
            ]),
            'http://example.com//example.com',
        ],
    ];
}

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