function TrustedRedirectResponseTest::providerCreateFromRedirectResponse

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php \Drupal\Tests\Core\Routing\TrustedRedirectResponseTest::providerCreateFromRedirectResponse()
  2. 10 core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php \Drupal\Tests\Core\Routing\TrustedRedirectResponseTest::providerCreateFromRedirectResponse()
  3. 11.x core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php \Drupal\Tests\Core\Routing\TrustedRedirectResponseTest::providerCreateFromRedirectResponse()

Return value

array

File

core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php, line 76

Class

TrustedRedirectResponseTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Routing%21TrustedRedirectResponse.php/class/TrustedRedirectResponse/8.9.x" title="Provides a redirect response which contains trusted URLs." class="local">\Drupal\Core\Routing\TrustedRedirectResponse</a> @group Routing

Namespace

Drupal\Tests\Core\Routing

Code

public function providerCreateFromRedirectResponse() {
    return [
        'cacheable-with-tags' => [
            (new CacheableRedirectResponse('/example'))->addCacheableDependency((new CacheableMetadata())->addCacheTags([
                'foo',
            ])),
        ],
        'cacheable-with-max-age-0' => [
            (new CacheableRedirectResponse('/example'))->addCacheableDependency((new CacheableMetadata())->setCacheMaxAge(0)),
        ],
        'uncacheable' => [
            new RedirectResponse('/example'),
        ],
    ];
}

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