You are here

public function CommentTestBase::setCommentSettings in Drupal 8

Same name in this branch
  1. 8 core/modules/comment/src/Tests/CommentTestBase.php \Drupal\comment\Tests\CommentTestBase::setCommentSettings()
  2. 8 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'.

4 calls to CommentTestBase::setCommentSettings()
CommentTestBase::setCommentAnonymous in core/modules/comment/src/Tests/CommentTestBase.php
Sets the value governing restrictions on anonymous comments.
CommentTestBase::setCommentForm in core/modules/comment/src/Tests/CommentTestBase.php
Sets the value governing whether the comment form is on its own page.
CommentTestBase::setCommentPreview in core/modules/comment/src/Tests/CommentTestBase.php
Sets the value governing the previewing mode for the comment form.
CommentTestBase::setCommentsPerPage in core/modules/comment/src/Tests/CommentTestBase.php
Sets the value specifying the default number of comments per page.

File

core/modules/comment/src/Tests/CommentTestBase.php, line 339

Class

CommentTestBase
Provides setup and helper methods for comment tests.

Namespace

Drupal\comment\Tests

Code

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

  // Display status message.
  $this
    ->pass($message);
}