You are here

function OverrideNodeOptionsTestCase::assertNodeFieldsUpdated in Override Node Options 8

Same name and namespace in other branches
  1. 6 override_node_options.test \OverrideNodeOptionsTestCase::assertNodeFieldsUpdated()

Assert that fields in a node were updated to certail values.

Parameters

$node: The node object to check (will be reloaded from the database).

$fields: An array of values to check equality, keyed by node object property.

3 calls to OverrideNodeOptionsTestCase::assertNodeFieldsUpdated()
OverrideNodeOptionsTestCase::testNodeAuthor in ./override_node_options.test
Test the 'Authoring information' fieldset.
OverrideNodeOptionsTestCase::testNodeOptions in ./override_node_options.test
Test the 'Authoring information' fieldset.
OverrideNodeOptionsTestCase::testNodeRevisions in ./override_node_options.test
Test the 'Revision information' fieldset.

File

./override_node_options.test, line 35
Unit tests for the override_node_options module.

Class

OverrideNodeOptionsTestCase
@file Unit tests for the override_node_options module.

Code

function assertNodeFieldsUpdated(stdClass $node, array $fields) {

  // Re-load the node from the database to make sure we have the current
  // values.
  $node = node_load($node->nid, NULL, TRUE);
  foreach ($fields as $field => $value) {
    $this
      ->assertEqual($node->{$field}, $value, t('Node @field was updated to !value, expected !expected.', array(
      '@field' => $field,
      '!value' => var_export($node->{$field}, TRUE),
      '!expected' => var_export($value, TRUE),
    )));
  }
}