You are here

function NodeSaveTestCase::testNodeSaveOnInsert in Drupal 7

Tests saving a node on node insert.

This test ensures that a node has been fully saved when hook_node_insert() is invoked, so that the node can be saved again in a hook implementation without errors.

See also

node_test_node_insert()

File

modules/node/node.test, line 1448
Tests for node.module.

Class

NodeSaveTestCase
Tests node save related functionality, including import-save.

Code

function testNodeSaveOnInsert() {

  // node_test_node_insert() triggers a save on insert if the title equals
  // 'new'.
  $node = $this
    ->drupalCreateNode(array(
    'title' => 'new',
  ));
  $this
    ->assertEqual($node->title, 'Node ' . $node->nid, 'Node saved on node insert.');
}