function DrupalWebTestCase::drupalGetNodeByTitle

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

Get a node from the database based on its title.


$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.

37 calls to DrupalWebTestCase::drupalGetNodeByTitle()
BookTestCase::createBookNode in drupal/modules/book/book.test
Creates a book node.
DBLogTestCase::doNode in drupal/modules/dblog/dblog.test
Generates and then verifies some node events.
FileFieldWidgetTestCase::testPrivateFileComment in drupal/modules/file/tests/file.test
Tests that download restrictions on private files work on comments.
FilterAdminTestCase::testFilterAdmin in drupal/modules/filter/filter.test
Tests filter administration functionality.
FilterFormatAccessTestCase::testFormatWidgetPermissions in drupal/modules/filter/filter.test
Tests editing a page using a disallowed text format.

... See full list


drupal/modules/simpletest/drupal_web_test_case.php, line 900


Test case for typical Drupal tests.


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;