You are here

public function CacheContextsManagerTest::providerTestOptimizeTokens in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 50
Contains \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest.

Class

CacheContextsManagerTest
@coversDefaultClass \Drupal\Core\Cache\Context\CacheContextsManager @group Cache

Namespace

Drupal\Tests\Core\Cache\Context

Code

public 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',
      ],
    ],
  ];
}