function DrupalWebTestCase::drupalGetNodeByTitle in SimpleTest 7.2
Same name and namespace in other branches
- 6.2 drupal_web_test_case.php \DrupalWebTestCase::drupalGetNodeByTitle()
- 7 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().
$reset: (optional) Whether to reset the internal node_load() cache.
Return value
A node object matching $title.
File
- ./
drupal_web_test_case.php, line 861 - Provides DrupalTestCase, DrupalUnitTestCase, and DrupalWebTestCase classes.
Class
- DrupalWebTestCase
- Test case for typical Drupal tests.
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;
}