function CommentTestBase::setCommentSettings

Same name in other branches
  1. 8.9.x core/modules/comment/src/Tests/CommentTestBase.php \Drupal\comment\Tests\CommentTestBase::setCommentSettings()
  2. 8.9.x core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setCommentSettings()
  3. 10 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setCommentSettings()
  4. 11.x core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setCommentSettings()

Sets a comment settings variable for the article content type.

Parameters

string $name: Name of variable.

string $value: Value of variable.

string $message: Status message to display.

string $field_name: (optional) Field name through which the comment should be posted. Defaults to 'comment'.

18 calls to CommentTestBase::setCommentSettings()
CommentAttributesTest::setUp in core/modules/rdf/tests/src/Functional/CommentAttributesTest.php
CommentInterfaceTest::setUp in core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
Set up comments to have subject and preview disabled.
CommentLinksTest::testCommentLinks in core/modules/comment/tests/src/Functional/CommentLinksTest.php
Tests that comment links are output and can be hidden.
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.

... See full list

File

core/modules/comment/tests/src/Functional/CommentTestBase.php, line 338

Class

CommentTestBase
Provides setup and helper methods for comment tests.

Namespace

Drupal\Tests\comment\Functional

Code

public function setCommentSettings($name, $value, $message, $field_name = 'comment') {
    $field = FieldConfig::loadByName('node', 'article', $field_name);
    $field->setSetting($name, $value);
    $field->save();
}

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