function EntityTestComputedFieldNormalizerTest::getExpectedNormalizedEntity

Same name in other branches
  1. 10 core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestComputedFieldNormalizerTest.php \Drupal\Tests\entity_test\Functional\Rest\EntityTestComputedFieldNormalizerTest::getExpectedNormalizedEntity()
  2. 11.x core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestComputedFieldNormalizerTest.php \Drupal\Tests\entity_test\Functional\Rest\EntityTestComputedFieldNormalizerTest::getExpectedNormalizedEntity()

Overrides EntityTestResourceTestBase::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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.