You are here

public function CommentTestBase::setCommentPreview in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/comment/src/Tests/CommentTestBase.php \Drupal\comment\Tests\CommentTestBase::setCommentPreview()

Sets the value governing the previewing mode for the comment form.

Parameters

int $mode: The preview mode: DRUPAL_DISABLED, DRUPAL_OPTIONAL or DRUPAL_REQUIRED.

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

15 calls to CommentTestBase::setCommentPreview()
CommentAttributesTest::setUp in core/modules/rdf/src/Tests/CommentAttributesTest.php
Sets up a Drupal site for running functional and integration tests.
CommentInterfaceTest::setUp in core/modules/comment/src/Tests/CommentInterfaceTest.php
Set up comments to have subject and preview disabled.
CommentInterfaceTest::testCommentInterface in core/modules/comment/src/Tests/CommentInterfaceTest.php
Tests the comment interface.
CommentNodeAccessTest::testThreadedCommentView in core/modules/comment/src/Tests/CommentNodeAccessTest.php
Test that threaded comments can be viewed.
CommentPagerTest::testCommentNewPageIndicator in core/modules/comment/src/Tests/CommentPagerTest.php
Tests calculation of first page with new comment.

... See full list

File

core/modules/comment/src/Tests/CommentTestBase.php, line 257
Contains \Drupal\comment\Tests\CommentTestBase.

Class

CommentTestBase
Provides setup and helper methods for comment tests.

Namespace

Drupal\comment\Tests

Code

public function setCommentPreview($mode, $field_name = 'comment') {
  switch ($mode) {
    case DRUPAL_DISABLED:
      $mode_text = 'disabled';
      break;
    case DRUPAL_OPTIONAL:
      $mode_text = 'optional';
      break;
    case DRUPAL_REQUIRED:
      $mode_text = 'required';
      break;
  }
  $this
    ->setCommentSettings('preview', $mode, format_string('Comment preview @mode_text.', array(
    '@mode_text' => $mode_text,
  )), $field_name);
}