function EntityTestJsonInternalPropertyNormalizerTest::getExpectedNormalizedEntity

Same name in other branches
  1. 9 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()
  3. 11.x core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestJsonInternalPropertyNormalizerTest.php \Drupal\Tests\entity_test\Functional\Rest\EntityTestJsonInternalPropertyNormalizerTest::getExpectedNormalizedEntity()

Overrides EntityTestResourceTestBase::getExpectedNormalizedEntity

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

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