function EntityTestHalJsonInternalPropertyNormalizerTest::getExpectedNormalizedEntity

Same name in other branches
  1. 9 core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonInternalPropertyNormalizerTest.php \Drupal\Tests\hal\Functional\entity_test\EntityTestHalJsonInternalPropertyNormalizerTest::getExpectedNormalizedEntity()

Overrides EntityTestHalJsonAnonTest::getExpectedNormalizedEntity

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;
}

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