function CommentTestBase::setCommentSubject
Same name in other branches
- 9 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setCommentSubject()
- 8.9.x core/modules/comment/src/Tests/CommentTestBase.php \Drupal\comment\Tests\CommentTestBase::setCommentSubject()
- 8.9.x core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setCommentSubject()
- 11.x core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setCommentSubject()
Sets the value governing whether the subject field should be enabled.
Parameters
bool $enabled: Boolean specifying whether the subject field should be enabled.
15 calls to CommentTestBase::setCommentSubject()
- CommentInterfaceTest::setUp in core/
modules/ comment/ tests/ src/ Functional/ CommentInterfaceTest.php - Set up comments to have subject and preview disabled.
- CommentInterfaceTest::testCommentInterface in core/
modules/ comment/ tests/ src/ Functional/ CommentInterfaceTest.php - Tests the comment interface.
- CommentNodeAccessTest::testThreadedCommentView in core/
modules/ comment/ tests/ src/ Functional/ CommentNodeAccessTest.php - Tests that threaded comments can be viewed.
- CommentPagerTest::testCommentNewPageIndicator in core/
modules/ comment/ tests/ src/ Functional/ CommentPagerTest.php - Tests calculation of first page with new comment.
- CommentPagerTest::testCommentOrderingThreading in core/
modules/ comment/ tests/ src/ Functional/ CommentPagerTest.php - Tests comment ordering and threading.
File
-
core/
modules/ comment/ tests/ src/ Functional/ CommentTestBase.php, line 244
Class
- CommentTestBase
- Provides setup and helper methods for comment tests.
Namespace
Drupal\Tests\comment\FunctionalCode
protected function setCommentSubject($enabled) {
$form_display = $this->container
->get('entity_display.repository')
->getFormDisplay('comment', 'comment');
if ($enabled) {
$form_display->setComponent('subject', [
'type' => 'string_textfield',
]);
}
else {
$form_display->removeComponent('subject');
}
$form_display->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.