You are here

protected function CommentTypeTest::createEntity in JSON:API 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/CommentTypeTest.php \Drupal\Tests\jsonapi\Functional\CommentTypeTest::createEntity()

Creates the entity to be tested.

Return value

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

Overrides ResourceTestBase::createEntity

File

tests/src/Functional/CommentTypeTest.php, line 47

Class

CommentTypeTest
JSON API integration test for the "CommentType" config entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function createEntity() {

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