Commit da4cd3cc authored by Dries's avatar Dries

- Patch #343746 by asimmonds: fixed typo in loading multiple terms at once. ...

- Patch #343746 by asimmonds: fixed typo in loading multiple terms at once.  Added a test for it too\!
parent ec4eba68
......@@ -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');
......
......@@ -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.'));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment