You are here

protected function NodeTypeTest::createEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php \Drupal\Tests\jsonapi\Functional\NodeTypeTest::createEntity()

Creates the entity to be tested.

Return value

\Drupal\Core\Entity\EntityInterface The entity to be tested.

Overrides ResourceTestBase::createEntity

File

core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php, line 52

Class

NodeTypeTest
JSON:API integration test for the "NodeType" config entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function createEntity() {

  // Create a "Camelids" node type.
  $camelids = NodeType::create([
    'name' => 'Camelids',
    'type' => 'camelids',
    'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
  ]);
  $camelids
    ->save();
  return $camelids;
}