protected function CommentTestBase::createCommentType in Drupal 10
Same name and namespace in other branches
- 8 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::createCommentType()
- 9 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::createCommentType()
Creates a comment type (bundle).
Parameters
string $label: The comment type label.
Return value
\Drupal\comment\Entity\CommentType Created comment type.
File
- core/
modules/ comment/ tests/ src/ Functional/ CommentTestBase.php, line 402
Class
- CommentTestBase
- Provides setup and helper methods for comment tests.
Namespace
Drupal\Tests\comment\FunctionalCode
protected function createCommentType($label) {
$bundle = CommentType::create([
'id' => $label,
'label' => $label,
'description' => '',
'target_entity_type_id' => 'node',
]);
$bundle
->save();
return $bundle;
}