From 58b0235a72859aa433d743a9f284504f24664857 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 5 Dec 2008 22:18:46 +0000 Subject: - Patch #324313 by catch et al: load multiple nodes and terms at once. --- modules/simpletest/drupal_web_test_case.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'modules/simpletest/drupal_web_test_case.php') diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 8fecb9ea0..9660d4483 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -446,6 +446,22 @@ class DrupalWebTestCase { $this->error($exception->getMessage(), 'Uncaught exception', _drupal_get_last_caller($backtrace)); } + /** + * Get a node from the database based on its title. + * + * @param title + * A node title, usually generated by $this->randomName(). + * + * @return + * A node object matching $title. + */ + 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; + } + /** * Creates a node based on default settings. * -- cgit v1.2.3