summaryrefslogtreecommitdiff
path: root/modules/simpletest
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-12-05 22:18:46 +0000
committerDries Buytaert <dries@buytaert.net>2008-12-05 22:18:46 +0000
commit58b0235a72859aa433d743a9f284504f24664857 (patch)
tree524132d2e7ca157baa1059117244a5b27b1f51fb /modules/simpletest
parent0b06c68b988410c49c9f4ffbf8c3160d4e9da2c7 (diff)
downloadbrdo-58b0235a72859aa433d743a9f284504f24664857.tar.gz
brdo-58b0235a72859aa433d743a9f284504f24664857.tar.bz2
- Patch #324313 by catch et al: load multiple nodes and terms at once.
Diffstat (limited to 'modules/simpletest')
-rw-r--r--modules/simpletest/drupal_web_test_case.php16
-rw-r--r--modules/simpletest/tests/taxonomy_test.module6
2 files changed, 20 insertions, 2 deletions
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
@@ -447,6 +447,22 @@ class DrupalWebTestCase {
}
/**
+ * 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.
*
* @param $settings
diff --git a/modules/simpletest/tests/taxonomy_test.module b/modules/simpletest/tests/taxonomy_test.module
index 2bbcf2453..d90148fa2 100644
--- a/modules/simpletest/tests/taxonomy_test.module
+++ b/modules/simpletest/tests/taxonomy_test.module
@@ -9,8 +9,10 @@
/**
* Implementation of hook_taxonomy_term_load().
*/
-function taxonomy_test_taxonomy_term_load($term) {
- $term->antonyms = taxonomy_test_get_antonyms($term->tid);
+function taxonomy_test_taxonomy_term_load(&$terms) {
+ foreach ($terms as $term) {
+ $term->antonyms = taxonomy_test_get_antonyms($term->tid);
+ }
}
/**