You are here

function DrupalWebTestCase::drupalGetNodeByTitle in SimpleTest 7

Same name and namespace in other branches
  1. 6.2 drupal_web_test_case.php \DrupalWebTestCase::drupalGetNodeByTitle()
  2. 7.2 drupal_web_test_case.php \DrupalWebTestCase::drupalGetNodeByTitle()

Get a node from the database based on its title.

Parameters

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

Return value

A node object matching $title.

File

./drupal_web_test_case.php, line 676

Class

DrupalWebTestCase
Test case for typical Drupal tests.

Code

function drupalGetNodeByTitle($title) {
  $nodes = node_load_multiple(array(), array(
    'title' => $title,
  ));

  // Load the first node returned from the database.
  $returned_node = reset($nodes);
  return $returned_node;
}