You are here

protected function CommentAlterTestBase::assertCommentDiff in Comment Alter 8

Asserts that a Comment Alter diff table on the current page is as expected.

Parameters

array $test: An associative array with keys for the field name referring to arrays with exactly two values: the original and new value as human readable strings.

10 calls to CommentAlterTestBase::assertCommentDiff()
CommentAlterImageTest::testImageFieldMultiple in tests/src/Functional/CommentAlterImageTest.php
Tests for multi valued image field comment altering.
CommentAlterImageTest::testImageFieldSingle in tests/src/Functional/CommentAlterImageTest.php
Tests for single valued image field comment altering.
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.

... See full list

File

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

Class

CommentAlterTestBase
Base class for Comment Alter test cases.

Namespace

Drupal\Tests\comment_alter\Functional

Code

protected function assertCommentDiff($test) {
  $fields = $this
    ->getCommentAlterations();

  // Compare the values passed in against what's on the page.
  foreach ($test as $field_name => $values) {
    $this
      ->assertTrue(isset($fields[$field_name]), 'Comment alterable field is present in the comment alter diff.');
    foreach ($values as $index => $value) {
      $this
        ->assertEquals($fields[$field_name][$index][0], $value[0], 'Comment alter diff original value matches.');
      $this
        ->assertEquals($fields[$field_name][$index][1], $value[1], 'Comment alter diff changed value matches.');
    }
  }
}