You are here

protected function EntityTestJsonInternalPropertyNormalizerTest::getExpectedNormalizedEntity in Drupal 9

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

Returns the expected normalization of the entity.

Return value

array

Overrides EntityTestResourceTestBase::getExpectedNormalizedEntity

See also

::createEntity()

File

core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestJsonInternalPropertyNormalizerTest.php, line 37

Class

EntityTestJsonInternalPropertyNormalizerTest
Test that internal properties are not exposed in the 'json' format.

Namespace

Drupal\Tests\entity_test\Functional\Rest

Code

protected function getExpectedNormalizedEntity() {
  $expected = parent::getExpectedNormalizedEntity();

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