function CommentTypeTest::createEntity

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

Overrides ResourceTestBase::createEntity

File

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

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

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