function JsonApiDocumentTopLevelNormalizerTest::testCacheableMetadataProvider
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php \Drupal\Tests\jsonapi\Kernel\Normalizer\JsonApiDocumentTopLevelNormalizerTest::testCacheableMetadataProvider()
- 10 core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php \Drupal\Tests\jsonapi\Kernel\Normalizer\JsonApiDocumentTopLevelNormalizerTest::testCacheableMetadataProvider()
- 11.x core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php \Drupal\Tests\jsonapi\Kernel\Normalizer\JsonApiDocumentTopLevelNormalizerTest::testCacheableMetadataProvider()
Provides test cases for asserting cacheable metadata behavior.
File
-
core/
modules/ jsonapi/ tests/ src/ Kernel/ Normalizer/ JsonApiDocumentTopLevelNormalizerTest.php, line 704
Class
- JsonApiDocumentTopLevelNormalizerTest
- @coversDefaultClass \Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer @group jsonapi
Namespace
Drupal\Tests\jsonapi\Kernel\NormalizerCode
public function testCacheableMetadataProvider() {
$cacheable_metadata = function ($metadata) {
return CacheableMetadata::createFromRenderArray([
'#cache' => $metadata,
]);
};
return [
[
$cacheable_metadata([
'contexts' => [
'languages:language_interface',
],
]),
[
'node--article' => 'body',
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.