function TrustedRedirectResponseTest::providerCreateFromRedirectResponse

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php \Drupal\Tests\Core\Routing\TrustedRedirectResponseTest::providerCreateFromRedirectResponse()
  2. 8.9.x 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 78

Class

TrustedRedirectResponseTest
@coversDefaultClass \Drupal\Core\Routing\TrustedRedirectResponse @group Routing

Namespace

Drupal\Tests\Core\Routing

Code

public static 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.