function JsonApiDocumentTopLevelNormalizerTest::testCacheableMetadataProvider
Provides test cases for asserting cacheable metadata behavior.
File
- 
              core/
modules/ jsonapi/ tests/ src/ Kernel/ Normalizer/ JsonApiDocumentTopLevelNormalizerTest.php, line 781  
Class
- JsonApiDocumentTopLevelNormalizerTest
 - @coversDefaultClass \Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer[[api-linebreak]] @group jsonapi @group #slow
 
Namespace
Drupal\Tests\jsonapi\Kernel\NormalizerCode
public static 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.