You are here

protected function EntityTestComputedFieldNormalizerTest::getExpectedNormalizedEntity in Drupal 10

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

File

core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestComputedFieldNormalizerTest.php, line 48

Class

EntityTestComputedFieldNormalizerTest
Test normalization of computed field.

Namespace

Drupal\Tests\entity_test\Functional\Rest

Code

protected function getExpectedNormalizedEntity() {
  $expected = parent::getExpectedNormalizedEntity();
  $expected['computed_reference_field'] = [];
  $expected['computed_string_field'] = [];
  unset($expected['field_test_text'], $expected['langcode'], $expected['type'], $expected['uuid']);

  // @see \Drupal\entity_test\Plugin\Field\ComputedTestCacheableStringItemList::computeValue().
  $expected['computed_test_cacheable_string_field'] = [
    [
      'value' => 'computed test cacheable string field',
    ],
  ];
  $expected['uuid'] = [
    0 => [
      'value' => $this->entity
        ->uuid(),
    ],
  ];
  return $expected;
}