summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-12-19 15:34:27 +0000
committerDries Buytaert <dries@buytaert.net>2008-12-19 15:34:27 +0000
commitda4cd3cc8cb6a644138e72ed56972b4f0f5a0033 (patch)
treebb6c285ac24cabe34041007c8d7e8f35db80a296 /modules
parentec4eba68d7eb4ee562a343a093253c550b108202 (diff)
downloadbrdo-da4cd3cc8cb6a644138e72ed56972b4f0f5a0033.tar.gz
brdo-da4cd3cc8cb6a644138e72ed56972b4f0f5a0033.tar.bz2
- Patch #343746 by asimmonds: fixed typo in loading multiple terms at once. Added a test for it too\!
Diffstat (limited to 'modules')
-rw-r--r--modules/taxonomy/taxonomy.module2
-rw-r--r--modules/taxonomy/taxonomy.test7
2 files changed, 8 insertions, 1 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 53963fd10..2658eb430 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -1103,7 +1103,7 @@ function taxonomy_term_load_multiple($tids = array(), $conditions = array(), $re
// If the conditions array is populated, add those to the query.
if ($conditions) {
foreach ($conditions as $field => $value) {
- $query->conditions('t.' . $field, $value);
+ $query->condition('t.' . $field, $value);
}
}
$queried_terms = $query->execute()->fetchAllAssoc('tid');
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index 9f36b680e..531d94812 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -491,5 +491,12 @@ class TaxonomyLoadMultipleUnitTest extends TaxonomyWebTestCase {
$terms4 = taxonomy_term_load_multiple(NULL, array('vid' => $vocabulary->vid), TRUE);
$this->assertTrue(count($terms4 == 4), t('Correct number of terms were loaded.'));
$this->assertFalse(isset($terms4[$deleted->tid]));
+
+ // Create a single term and load it by name.
+ $term = $this->createTerm($vocabulary->vid);
+ $loaded_terms = taxonomy_term_load_multiple(array(), array('name' => $term->name));
+ $this->assertEqual(count($loaded_terms), 1, t('One term was loaded'));
+ $loaded_term = reset($loaded_terms);
+ $this->assertEqual($term->tid, $loaded_term->tid, t('Term loaded by name successfully.'));
}
}