function CommentTypeResourceTestBase::createEntity

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

Overrides EntityResourceTestBase::createEntity

File

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.