You are here

protected function EntityTestHalJsonInternalPropertyNormalizerTest::getExpectedNormalizedEntity in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonInternalPropertyNormalizerTest.php \Drupal\Tests\entity_test\Functional\Hal\EntityTestHalJsonInternalPropertyNormalizerTest::getExpectedNormalizedEntity()

Returns the expected normalization of the entity.

Return value

array

Overrides EntityTestHalJsonAnonTest::getExpectedNormalizedEntity

See also

::createEntity()

File

core/modules/system/tests/modules/entity_test/tests/src/Functional/Hal/EntityTestHalJsonInternalPropertyNormalizerTest.php, line 33

Class

EntityTestHalJsonInternalPropertyNormalizerTest
Test that internal properties are not exposed in the 'hal_json' format.

Namespace

Drupal\Tests\entity_test\Functional\Hal

Code

protected function getExpectedNormalizedEntity() {
  $default_normalization = parent::getExpectedNormalizedEntity();
  $normalization = $this
    ->applyHalFieldNormalization($default_normalization);

  // The 'internal_value' property in test field type will not be returned in
  // normalization because setInternal(FALSE) was not called for this
  // property.
  // @see \Drupal\entity_test\Plugin\Field\FieldType\InternalPropertyTestFieldItem::propertyDefinitions
  $normalization['field_test_internal'] = [
    [
      'value' => 'This value shall not be internal!',
      'non_internal_value' => 'Computed! This value shall not be internal!',
    ],
  ];
  return $normalization;
}