protected function FieldConfigTest::createAnotherEntity in JSON:API 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/FieldConfigTest.php \Drupal\Tests\jsonapi\Functional\FieldConfigTest::createAnotherEntity()
Creates another entity to be tested.
Parameters
mixed $key: A unique key to be used for the ID and/or label of the duplicated entity.
Return value
\Drupal\Core\Entity\EntityInterface Another entity based on $this->entity.
Throws
\Drupal\Core\Entity\EntityStorageException
Overrides ResourceTestBase::createAnotherEntity
File
- tests/
src/ Functional/ FieldConfigTest.php, line 144
Class
- FieldConfigTest
- JSON API integration test for the "FieldConfig" config entity type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function createAnotherEntity($key) {
NodeType::create([
'name' => 'Pachyderms',
'type' => 'pachyderms',
])
->save();
$field_storage = FieldStorageConfig::create([
'field_name' => 'field_pachyderm',
'entity_type' => 'node',
'type' => 'text',
]);
$field_storage
->save();
$entity = FieldConfig::create([
'field_storage' => $field_storage,
'bundle' => 'pachyderms',
]);
$entity
->save();
return $entity;
}