function CacheableMetadataTest::providerTestCreateFromObject
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php \Drupal\Tests\Core\Cache\CacheableMetadataTest::providerTestCreateFromObject()
- 8.9.x core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php \Drupal\Tests\Core\Cache\CacheableMetadataTest::providerTestCreateFromObject()
- 10 core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php \Drupal\Tests\Core\Cache\CacheableMetadataTest::providerTestCreateFromObject()
Provides test data for createFromObject().
Return value
array
File
-
core/
tests/ Drupal/ Tests/ Core/ Cache/ CacheableMetadataTest.php, line 190
Class
- CacheableMetadataTest
- @coversDefaultClass \Drupal\Core\Cache\CacheableMetadata @group Cache
Namespace
Drupal\Tests\Core\CacheCode
public static function providerTestCreateFromObject() {
$data = [];
$empty_metadata = new CacheableMetadata();
$nonempty_metadata = new CacheableMetadata();
$nonempty_metadata->setCacheContexts([
'qux',
])
->setCacheTags([
'foo:bar',
])
->setCacheMaxAge(600);
$uncacheable_metadata = new CacheableMetadata();
$uncacheable_metadata->setCacheMaxAge(0);
$empty_cacheable_object = new TestCacheableDependency([], [], Cache::PERMANENT);
$nonempty_cacheable_object = new TestCacheableDependency([
'qux',
], [
'foo:bar',
], 600);
$uncacheable_object = new \stdClass();
$data[] = [
$empty_cacheable_object,
$empty_metadata,
];
$data[] = [
$nonempty_cacheable_object,
$nonempty_metadata,
];
$data[] = [
$uncacheable_object,
$uncacheable_metadata,
];
return $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.