public function ConfigEntityNormalizerTest::testNormalize in JSON:API 8
@covers ::normalize @dataProvider normalizeProvider
File
- tests/
src/ Unit/ Normalizer/ ConfigEntityNormalizerTest.php, line 52
Class
- ConfigEntityNormalizerTest
- @coversDefaultClass \Drupal\jsonapi\Normalizer\ConfigEntityNormalizer @group jsonapi
Namespace
Drupal\Tests\jsonapi\Unit\NormalizerCode
public function testNormalize($input, $expected) {
$entity = $this
->prophesize(ConfigEntityInterface::class);
$entity
->toArray()
->willReturn([
'amet' => $input,
]);
$entity
->getCacheContexts()
->willReturn([]);
$entity
->getCacheTags()
->willReturn([]);
$entity
->getCacheMaxAge()
->willReturn(-1);
$entity
->getEntityTypeId()
->willReturn('');
$entity
->bundle()
->willReturn('');
$normalized = $this->normalizer
->normalize($entity
->reveal(), 'api_json', []);
$first = $normalized
->getValues();
$first = reset($first);
$this
->assertSame($expected, $first
->rasterizeValue());
}