You are here

public function CommentTestBase::setCommentSettings in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/comment/tests/src/Functional/CommentTestBase.php \Drupal\Tests\comment\Functional\CommentTestBase::setCommentSettings()
  2. 9 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'.

File

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

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