function CacheContextsManagerTest::providerTestOptimizeTokens

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest::providerTestOptimizeTokens()
  2. 8.9.x core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest::providerTestOptimizeTokens()
  3. 11.x core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest::providerTestOptimizeTokens()

Provides a list of context token sets.

File

core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php, line 69

Class

CacheContextsManagerTest
@coversDefaultClass \Drupal\Core\Cache\Context\CacheContextsManager[[api-linebreak]] @group Cache

Namespace

Drupal\Tests\Core\Cache\Context

Code

public static function providerTestOptimizeTokens() {
  return [
    [
      [
        'a',
        'x',
      ],
      [
        'a',
        'x',
      ],
    ],
    [
      [
        'a.b',
        'x',
      ],
      [
        'a.b',
        'x',
      ],
    ],
    // Direct ancestor, single-level hierarchy.
[
      [
        'a',
        'a.b',
      ],
      [
        'a',
      ],
    ],
    [
      [
        'a.b',
        'a',
      ],
      [
        'a',
      ],
    ],
    // Direct ancestor, multi-level hierarchy.
[
      [
        'a.b',
        'a.b.c',
      ],
      [
        'a.b',
      ],
    ],
    [
      [
        'a.b.c',
        'a.b',
      ],
      [
        'a.b',
      ],
    ],
    // Indirect ancestor.
[
      [
        'a',
        'a.b.c',
      ],
      [
        'a',
      ],
    ],
    [
      [
        'a.b.c',
        'a',
      ],
      [
        'a',
      ],
    ],
    // Direct & indirect ancestors.
[
      [
        'a',
        'a.b',
        'a.b.c',
      ],
      [
        'a',
      ],
    ],
    [
      [
        'a',
        'a.b.c',
        'a.b',
      ],
      [
        'a',
      ],
    ],
    [
      [
        'a.b',
        'a',
        'a.b.c',
      ],
      [
        'a',
      ],
    ],
    [
      [
        'a.b',
        'a.b.c',
        'a',
      ],
      [
        'a',
      ],
    ],
    [
      [
        'a.b.c',
        'a.b',
        'a',
      ],
      [
        'a',
      ],
    ],
    [
      [
        'a.b.c',
        'a',
        'a.b',
      ],
      [
        'a',
      ],
    ],
    // Using parameters.
[
      [
        'a',
        'a.b.c:foo',
      ],
      [
        'a',
      ],
    ],
    [
      [
        'a.b.c:foo',
        'a',
      ],
      [
        'a',
      ],
    ],
    [
      [
        'a.b.c:foo',
        'a.b.c',
      ],
      [
        'a.b.c',
      ],
    ],
    // max-age 0 is treated as non-optimizable.
[
      [
        'a.b.no-optimize',
        'a.b',
        'a',
      ],
      [
        'a.b.no-optimize',
        'a',
      ],
    ],
  ];
}

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