You are here

function DrupalWebTestCase::drupalGetNodeByTitle in Drupal 7

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.

40 calls to DrupalWebTestCase::drupalGetNodeByTitle()
BookTestCase::createBookNode in modules/book/book.test
Creates a book node.
DBLogTestCase::doNode in modules/dblog/dblog.test
Generates and then verifies some node events.
FileFieldWidgetTestCase::doTestTemporaryFileRemovalExploit in modules/file/tests/file.test
Helper for testing exploiting the temporary file removal using fid.
FileFieldWidgetTestCase::testPrivateFileComment in modules/file/tests/file.test
Tests that download restrictions on private files work on comments.
FilePrivateTestCase::testPrivateFile in modules/file/tests/file.test
Tests file access for file uploaded to a private node.

... See full list

File

modules/simpletest/drupal_web_test_case.php, line 970

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;
}