You are here

public function WorkbenchModerationExternalNodeUpdateTestCase::assertModerationStatus in Workbench Moderation 7.3

Same name and namespace in other branches
  1. 7 tests/external_node_update.test \WorkbenchModerationExternalNodeUpdateTestCase::assertModerationStatus()

Checks if the node history table matches the expected values.

Parameters

array $expected: An associative array containing expected moderation status values.

string $status: Which status to assert. Can be either 'current' or 'published'.

string $message: The message to display along with the assertion.

Return value

bool TRUE if the assertion succeeded, FALSE otherwise.

1 call to WorkbenchModerationExternalNodeUpdateTestCase::assertModerationStatus()
WorkbenchModerationExternalNodeUpdateTestCase::testNodeSave in tests/external_node_update.test
Tests if nodes can be moderated by third party modules.

File

tests/external_node_update.test, line 121
Tests moderation states when nodes are (un)published by other modules.

Class

WorkbenchModerationExternalNodeUpdateTestCase
@file Tests moderation states when nodes are (un)published by other modules.

Code

public function assertModerationStatus(array $expected, $status = 'is_current', $message = '') {
  $record = $this
    ->getModerationRecord($status);
  $success = TRUE;
  foreach ($expected as $key => $value) {
    $success |= $this
      ->assertEqual($value, $record[$key], format_string('Found value %value for %key, expected %expected.', array(
      '%key' => $key,
      '%value' => $record[$key],
      '%expected' => $value,
    )));
  }
  return $this
    ->assertTrue($success, $message);
}