You are here

public function JsonApiDocumentTopLevelNormalizerTest::testCacheableMetadataProvider in Drupal 8

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\Normalizer

Code

public function testCacheableMetadataProvider() {
  $cacheable_metadata = function ($metadata) {
    return CacheableMetadata::createFromRenderArray([
      '#cache' => $metadata,
    ]);
  };
  return [
    [
      $cacheable_metadata([
        'contexts' => [
          'languages:language_interface',
        ],
      ]),
      [
        'node--article' => 'body',
      ],
    ],
  ];
}