function EntityTestHalJsonInternalPropertyNormalizerTest::getExpectedNormalizedEntity

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

Overrides EntityTestHalJsonAnonTest::getExpectedNormalizedEntity

File

core/modules/hal/tests/src/Functional/entity_test/EntityTestHalJsonInternalPropertyNormalizerTest.php, line 34

Class

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

Namespace

Drupal\Tests\hal\Functional\entity_test

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.