DrupalWebTestCase::drupalGetNodeByTitle

7 drupal_web_test_case.php DrupalWebTestCase::drupalGetNodeByTitle($title, $reset = FALSE)

Get a node from the database based on its title.

Parameters

$title: A node title, usually generated by $this->randomName().

$reset: (optional) Whether to reset the internal node_load() cache.

Return value

A node object matching $title.

File

modules/simpletest/drupal_web_test_case.php, line 882

Code

function drupalGetNodeByTitle($title, $reset = FALSE) {
  $nodes = node_load_multiple(array(), array('title' => $title), $reset);
  // Load the first node returned from the database.
  $returned_node = reset($nodes);
  return $returned_node;
}
Login or register to post comments