You are here

public function FieldNormalizerValueTest::testRasterizeIncludes in JSON:API 8

@covers ::rasterizeIncludes

File

tests/src/Unit/Normalizer/Value/FieldNormalizerValueTest.php, line 82

Class

FieldNormalizerValueTest
@coversDefaultClass \Drupal\jsonapi\Normalizer\Value\FieldNormalizerValue @group jsonapi

Namespace

Drupal\Tests\jsonapi\Unit\Normalizer\Value

Code

public function testRasterizeIncludes() {
  $value = $this
    ->prophesize(RelationshipItemNormalizerValue::class);
  $include = $this
    ->prophesize('\\Drupal\\jsonapi\\Normalizer\\Value\\EntityNormalizerValue');
  $include
    ->rasterizeValue()
    ->willReturn('Lorem');
  $value
    ->getCacheContexts()
    ->willReturn([
    'ccfoo',
  ]);
  $value
    ->getCacheTags()
    ->willReturn([
    'ctfoo',
  ]);
  $value
    ->getCacheMaxAge()
    ->willReturn(15);
  $value
    ->getInclude()
    ->willReturn($include
    ->reveal());
  $object = new FieldNormalizerValue(AccessResult::allowed(), [
    $value
      ->reveal(),
  ], 1, 'attributes');
  $this
    ->assertEquals([
    'Lorem',
  ], $object
    ->rasterizeIncludes());
}