use Drupal\entity_test\Entity\EntityTest;
use Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait;
use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
+use Drupal\Tests\Traits\ExpectDeprecationTrait;
use Drupal\user\Entity\User;
abstract class EntityTestResourceTestBase extends EntityResourceTestBase {
use BcTimestampNormalizerUnixTestTrait;
+ use ExpectDeprecationTrait;
/**
* {@inheritdoc}
* {@inheritdoc}
*/
protected function createEntity() {
+ // Set flag so that internal field 'internal_string_field' is created.
+ // @see entity_test_entity_base_field_info()
+ $this->container->get('state')->set('entity_test.internal_field', TRUE);
+ \Drupal::entityDefinitionUpdateManager()->applyUpdates();
+
$entity_test = EntityTest::create([
'name' => 'Llama',
'type' => 'entity_test',
+ // Set a value for the internal field to confirm that it will not be
+ // returned in normalization.
+ // @see entity_test_entity_base_field_info().
+ 'internal_string_field' => [
+ 'value' => 'This value shall not be internal!',
+ ],
]);
$entity_test->setOwnerId(0);
$entity_test->save();