You are here

protected function CommentTypeResourceTestBase::createEntity in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/comment/tests/src/Functional/Rest/CommentTypeResourceTestBase.php \Drupal\Tests\comment\Functional\Rest\CommentTypeResourceTestBase::createEntity()
  2. 9 core/modules/comment/tests/src/Functional/Rest/CommentTypeResourceTestBase.php \Drupal\Tests\comment\Functional\Rest\CommentTypeResourceTestBase::createEntity()

File

core/modules/comment/tests/src/Functional/Rest/CommentTypeResourceTestBase.php, line 40

Class

CommentTypeResourceTestBase
ResourceTestBase for CommentType entity.

Namespace

Drupal\Tests\comment\Functional\Rest

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;
}