function CacheContextsManagerTest::validateTokensProvider
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest::validateTokensProvider()
- 10 core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest::validateTokensProvider()
- 11.x core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest::validateTokensProvider()
Provides a list of cache context token arrays.
Return value
array
File
-
core/
tests/ Drupal/ Tests/ Core/ Cache/ Context/ CacheContextsManagerTest.php, line 204
Class
- CacheContextsManagerTest
- @coversDefaultClass \Drupal\Core\Cache\Context\CacheContextsManager @group Cache
Namespace
Drupal\Tests\Core\Cache\ContextCode
public function validateTokensProvider() {
return [
[
[],
FALSE,
],
[
[
'foo',
],
FALSE,
],
[
[
'foo',
'foo.bar',
],
FALSE,
],
[
[
'foo',
'baz:llama',
],
FALSE,
],
// Invalid.
[
[
FALSE,
],
'Cache contexts must be strings, boolean given.',
],
[
[
TRUE,
],
'Cache contexts must be strings, boolean given.',
],
[
[
'foo',
FALSE,
],
'Cache contexts must be strings, boolean given.',
],
[
[
NULL,
],
'Cache contexts must be strings, NULL given.',
],
[
[
'foo',
NULL,
],
'Cache contexts must be strings, NULL given.',
],
[
[
1337,
],
'Cache contexts must be strings, integer given.',
],
[
[
'foo',
1337,
],
'Cache contexts must be strings, integer given.',
],
[
[
3.14,
],
'Cache contexts must be strings, double given.',
],
[
[
'foo',
3.14,
],
'Cache contexts must be strings, double given.',
],
[
[
[],
],
'Cache contexts must be strings, array given.',
],
[
[
'foo',
[],
],
'Cache contexts must be strings, array given.',
],
[
[
'foo',
[
'bar',
],
],
'Cache contexts must be strings, array given.',
],
[
[
new \stdClass(),
],
'Cache contexts must be strings, object given.',
],
[
[
'foo',
new \stdClass(),
],
'Cache contexts must be strings, object given.',
],
// Non-existing.
[
[
'foo.bar',
'qux',
],
'"qux" is not a valid cache context ID.',
],
[
[
'qux',
'baz',
],
'"qux" is not a valid cache context ID.',
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.