protected function CommentTestBase::createCommentType in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/comment/src/Tests/CommentTestBase.php \Drupal\comment\Tests\CommentTestBase::createCommentType()
Creates a comment comment type (bundle).
Parameters
string $label: The comment type label.
Return value
\Drupal\comment\Entity\CommentType Created comment type.
2 calls to CommentTestBase::createCommentType()
- CommentTypeTest::testCommentTypeCreation in core/
modules/ comment/ src/ Tests/ CommentTypeTest.php - Tests creating a comment type programmatically and via a form.
- CommentTypeTest::testCommentTypeDeletion in core/
modules/ comment/ src/ Tests/ CommentTypeTest.php - Tests deleting a comment type that still has content.
File
- core/
modules/ comment/ src/ Tests/ CommentTestBase.php, line 395 - Contains \Drupal\comment\Tests\CommentTestBase.
Class
- CommentTestBase
- Provides setup and helper methods for comment tests.
Namespace
Drupal\comment\TestsCode
protected function createCommentType($label) {
$bundle = CommentType::create(array(
'id' => $label,
'label' => $label,
'description' => '',
'target_entity_type_id' => 'node',
));
$bundle
->save();
return $bundle;
}