You are here

private function OverrideNodeOptionsTest::assertNodeFieldsUpdated in Override Node Options 7

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

Parameters

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

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

3 calls to OverrideNodeOptionsTest::assertNodeFieldsUpdated()
OverrideNodeOptionsTest::testNodeAuthor in src/Tests/Functional/OverrideNodeOptionsTest.php
Test the 'Authoring information' fieldset.
OverrideNodeOptionsTest::testNodeOptions in src/Tests/Functional/OverrideNodeOptionsTest.php
Test the 'Authoring information' fieldset.
OverrideNodeOptionsTest::testNodeRevisions in src/Tests/Functional/OverrideNodeOptionsTest.php
Test the 'Revision information' fieldset.

File

src/Tests/Functional/OverrideNodeOptionsTest.php, line 58
Unit tests for the override_node_options module.

Class

OverrideNodeOptionsTest
Defines a base class for testing the Override Node Options module.

Namespace

Drupal\override_node_options\Tests\Functional

Code

private 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),
    )));
  }
}