function NodeSaveTest::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

drupal/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php, line 169
Definition of Drupal\node\Tests\NodeSaveTest.

Class

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

Namespace

Drupal\node\Tests

Code

function testNodeSaveOnInsert() {

  // node_test_node_insert() tiggers 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.');
}