You are here

protected function CommentAlterTestBase::postComment in Comment Alter 8

Posts a comment using the psuedo browser.

Parameters

array $comment_edit: (optional) An array that gets added to the $edit array passed to $this->drupalPostForm().

8 calls to CommentAlterTestBase::postComment()
CommentAlterListStringTest::testOptionsButtonMultiple in tests/src/Functional/CommentAlterListStringTest.php
Tests for multi-valued List (string) fields comment altering.
CommentAlterListStringTest::testOptionsButtonSingle in tests/src/Functional/CommentAlterListStringTest.php
Tests for single valued List (string) fields comment altering.
CommentAlterListStringTest::testOptionsSelectMultiple in tests/src/Functional/CommentAlterListStringTest.php
Tests for multi-valued List (string) fields comment altering.
CommentAlterListStringTest::testOptionsSelectSingle in tests/src/Functional/CommentAlterListStringTest.php
Tests for single valued List (string) fields comment altering.
CommentAlterNodeReferenceTest::testEntityReferenceFieldMultiple in tests/src/Functional/CommentAlterNodeReferenceTest.php
Tests for multi-valued node reference field comment altering.

... See full list

File

tests/src/Functional/CommentAlterTestBase.php, line 184

Class

CommentAlterTestBase
Base class for Comment Alter test cases.

Namespace

Drupal\Tests\comment_alter\Functional

Code

protected function postComment($comment_edit = []) {

  // Populate the subject and body fields.
  $edit['comment_body[0][value]'] = $this
    ->randomString();
  $edit['subject[0][value]'] = $this
    ->randomString();
  $edit = array_merge($edit, $comment_edit);
  $this
    ->drupalGet('comment/reply/' . $this->entityType . '/' . $this->entity
    ->id() . '/comment');
  $this
    ->drupalPostForm(NULL, $edit, t('Save'));
}