function FieldItemNormalizerTest::testNormalizeFieldItemWithoutProperties
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Kernel/Normalizer/FieldItemNormalizerTest.php \Drupal\Tests\jsonapi\Kernel\Normalizer\FieldItemNormalizerTest::testNormalizeFieldItemWithoutProperties()
- 10 core/modules/jsonapi/tests/src/Kernel/Normalizer/FieldItemNormalizerTest.php \Drupal\Tests\jsonapi\Kernel\Normalizer\FieldItemNormalizerTest::testNormalizeFieldItemWithoutProperties()
Tests a field item that has no properties.
@covers ::normalize
File
-
core/
modules/ jsonapi/ tests/ src/ Kernel/ Normalizer/ FieldItemNormalizerTest.php, line 63
Class
- FieldItemNormalizerTest
- @coversDefaultClass \Drupal\jsonapi\Normalizer\FieldItemNormalizer @group jsonapi
Namespace
Drupal\Tests\jsonapi\Kernel\NormalizerCode
public function testNormalizeFieldItemWithoutProperties() : void {
$item = $this->prophesize(FieldItemInterface::class);
$item->getProperties(TRUE)
->willReturn([]);
$item->getValue()
->willReturn('Direct call to getValue');
$result = $this->normalizer
->normalize($item->reveal(), 'api_json');
assert($result instanceof CacheableNormalization);
$this->assertSame('Direct call to getValue', $result->getNormalization());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.