You are here

protected function CommentAlterBaseTestCase::assertCommentDiff in Comment Alter 7

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.

(optional) int $ord: If there are multiple diff tables on the page, this specifies which one in sequential order.

9 calls to CommentAlterBaseTestCase::assertCommentDiff()
CommentAlterFileTestCase::testFileFieldMultiple in ./comment_alter.test
CommentAlterFileTestCase::testFileFieldSingle in ./comment_alter.test
CommentAlterListTextTestCase::testOptionsButtonsMultiple in ./comment_alter.test
CommentAlterListTextTestCase::testOptionsButtonsSingle in ./comment_alter.test
CommentAlterListTextTestCase::testOptionsSelectMultiple in ./comment_alter.test

... See full list

File

./comment_alter.test, line 203
Functional tests for the Comment Alter module.

Class

CommentAlterBaseTestCase
Parent of all the test cases for Comment Alter.

Code

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

  // Compare the values passed in against what's on the page.
  foreach ($test as $field_name => $values) {
    $this
      ->assertTrue(isset($fields[$field_name]), "No field called '{$field_name}' found in comment alter diff #{$ord}");
    foreach ($values as $index => $value) {
      $this
        ->assertEqual($fields[$field_name][$index][0], $value[0], "Comment alter diff original for field '{$field_name}' [{$index}] doesn't match: {$fields[$field_name][$index][0]} != {$value[0]}");
      $this
        ->assertEqual($fields[$field_name][$index][1], $value[1], "Comment alter diff changed for field '{$field_name}' [{$index}] doesn't match: {$fields[$field_name][$index][1]} != {$value[1]}");
    }
  }
}