protected function EntityTestResourceTestBase::createEntity in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestResourceTestBase.php \Drupal\Tests\entity_test\Functional\Rest\EntityTestResourceTestBase::createEntity()
Creates the entity to be tested.
Return value
\Drupal\Core\Entity\EntityInterface The entity to be tested.
Overrides EntityResourceTestBase::createEntity
3 calls to EntityTestResourceTestBase::createEntity()
- EntityTestHalJsonInternalPropertyNormalizerTest::createEntity in core/
modules/ system/ tests/ modules/ entity_test/ tests/ src/ Functional/ Hal/ EntityTestHalJsonInternalPropertyNormalizerTest.php - Creates the entity to be tested.
- EntityTestJsonInternalPropertyNormalizerTest::createEntity in core/
modules/ system/ tests/ modules/ entity_test/ tests/ src/ Functional/ Rest/ EntityTestJsonInternalPropertyNormalizerTest.php - Creates the entity to be tested.
- EntityTestTextItemNormalizerTest::createEntity in core/
modules/ system/ tests/ modules/ entity_test/ tests/ src/ Functional/ Rest/ EntityTestTextItemNormalizerTest.php - Creates the entity to be tested.
6 methods override EntityTestResourceTestBase::createEntity()
- EntityTestDateonlyTest::createEntity in core/
modules/ datetime/ tests/ src/ Functional/ EntityResource/ EntityTest/ EntityTestDateonlyTest.php - Creates the entity to be tested.
- EntityTestDateRangeTest::createEntity in core/
modules/ datetime_range/ tests/ src/ Functional/ EntityResource/ EntityTest/ EntityTestDateRangeTest.php - Creates the entity to be tested.
- EntityTestDatetimeTest::createEntity in core/
modules/ datetime/ tests/ src/ Functional/ EntityResource/ EntityTest/ EntityTestDatetimeTest.php - Creates the entity to be tested.
- EntityTestHalJsonInternalPropertyNormalizerTest::createEntity in core/
modules/ system/ tests/ modules/ entity_test/ tests/ src/ Functional/ Hal/ EntityTestHalJsonInternalPropertyNormalizerTest.php - Creates the entity to be tested.
- EntityTestJsonInternalPropertyNormalizerTest::createEntity in core/
modules/ system/ tests/ modules/ entity_test/ tests/ src/ Functional/ Rest/ EntityTestJsonInternalPropertyNormalizerTest.php - Creates the entity to be tested.
File
- core/
modules/ system/ tests/ modules/ entity_test/ tests/ src/ Functional/ Rest/ EntityTestResourceTestBase.php, line 56
Class
Namespace
Drupal\Tests\entity_test\Functional\RestCode
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);
$this
->applyEntityUpdates('entity_test');
$entity_test = \Drupal::entityTypeManager()
->getStorage(static::$entityTypeId)
->create([
'name' => 'Llama',
'type' => static::$entityTypeId,
// 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();
return $entity_test;
}