X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Frest%2Ftests%2Fsrc%2FFunctional%2FEntityResource%2FEntityTest%2FEntityTestResourceTestBase.php;fp=web%2Fcore%2Fmodules%2Frest%2Ftests%2Fsrc%2FFunctional%2FEntityResource%2FEntityTest%2FEntityTestResourceTestBase.php;h=0c82ea95a28d05116f3a310c8a7a441d17984d09;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=e2c0ccdf652ef1124151abc24b8d3552cb374fba;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/web/core/modules/rest/tests/src/Functional/EntityResource/EntityTest/EntityTestResourceTestBase.php b/web/core/modules/rest/tests/src/Functional/EntityResource/EntityTest/EntityTestResourceTestBase.php index e2c0ccdf6..0c82ea95a 100644 --- a/web/core/modules/rest/tests/src/Functional/EntityResource/EntityTest/EntityTestResourceTestBase.php +++ b/web/core/modules/rest/tests/src/Functional/EntityResource/EntityTest/EntityTestResourceTestBase.php @@ -5,11 +5,13 @@ namespace Drupal\Tests\rest\Functional\EntityResource\EntityTest; 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} @@ -53,9 +55,20 @@ abstract class EntityTestResourceTestBase extends EntityResourceTestBase { * {@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();