public function CacheableMetadataTest::providerTestMerge in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php \Drupal\Tests\Core\Cache\CacheableMetadataTest::providerTestMerge()
Provides test data for testMerge().
Return value
array
File
- core/
tests/ Drupal/ Tests/ Core/ Cache/ CacheableMetadataTest.php, line 69
Class
- CacheableMetadataTest
- @coversDefaultClass \Drupal\Core\Cache\CacheableMetadata @group Cache
Namespace
Drupal\Tests\Core\CacheCode
public function providerTestMerge() {
return [
// All empty.
[
new CacheableMetadata(),
new CacheableMetadata(),
new CacheableMetadata(),
],
// Cache contexts.
[
(new CacheableMetadata())
->setCacheContexts([
'foo',
]),
(new CacheableMetadata())
->setCacheContexts([
'bar',
]),
(new CacheableMetadata())
->setCacheContexts([
'bar',
'foo',
]),
],
// Cache tags.
[
(new CacheableMetadata())
->setCacheTags([
'foo',
]),
(new CacheableMetadata())
->setCacheTags([
'bar',
]),
(new CacheableMetadata())
->setCacheTags([
'foo',
'bar',
]),
],
// Cache max-ages.
[
(new CacheableMetadata())
->setCacheMaxAge(60),
(new CacheableMetadata())
->setCacheMaxAge(Cache::PERMANENT),
(new CacheableMetadata())
->setCacheMaxAge(60),
],
];
}