You are here

public function CommentAlterListStringTest::testOptionsSelectSingle in Comment Alter 8

Tests for single valued List (string) fields comment altering.

File

tests/src/Functional/CommentAlterListStringTest.php, line 42

Class

CommentAlterListStringTest
Tests the comment alter module functions for List (string) fields.

Namespace

Drupal\Tests\comment_alter\Functional

Code

public function testOptionsSelectSingle() {
  $field_name = $this
    ->addOptionField('options_select', 1);
  $this
    ->createEntityObject([
    $field_name => [
      'value' => 1,
    ],
  ]);
  $this
    ->assertAlterableField($field_name);
  $this
    ->postComment([
    "comment_alter_fields[{$field_name}]" => 2,
  ]);
  $this
    ->assertCommentDiff([
    $field_name => [
      [
        1,
        2,
      ],
    ],
  ]);
  $this
    ->assertCommentSettings($field_name);
  $this
    ->assertRevisionDelete();
}