function NodeSaveTestCase::testNodeSaveOnInsert

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 1469

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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.