Skip to content
Snippets Groups Projects
Commit 31dbee54 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #432154 by Berdir: fixed bug in taxonomy_vocabulary_load_multiple. With tests.

parent d79481b3
No related branches found
No related tags found
No related merge requests found
...@@ -1019,7 +1019,7 @@ function taxonomy_vocabulary_load_multiple($vids = array(), $conditions = array( ...@@ -1019,7 +1019,7 @@ function taxonomy_vocabulary_load_multiple($vids = array(), $conditions = array(
$query->orderBy('v.name'); $query->orderBy('v.name');
if (!empty($type)) { if (!empty($type)) {
$query->leftJoin('taxonomy_vocabulary_node_type', 'n', 'v.vid = n.vid WHERE n.type = :type', array(':type' => $type)); $query->leftJoin('taxonomy_vocabulary_node_type', 'n', 'v.vid = n.vid AND n.type = :type', array(':type' => $type));
} }
else { else {
$query->leftJoin('taxonomy_vocabulary_node_type', 'n', 'v.vid = n.vid'); $query->leftJoin('taxonomy_vocabulary_node_type', 'n', 'v.vid = n.vid');
......
...@@ -276,6 +276,11 @@ public static function getInfo() { ...@@ -276,6 +276,11 @@ public static function getInfo() {
// Fetch vocabulary 1 by name and ID. // Fetch vocabulary 1 by name and ID.
$this->assertTrue(current(taxonomy_vocabulary_load_multiple(array($vocabulary1->vid), array('name' => $vocabulary1->name))) == $vocabulary1, t('Vocabulary loaded successfully by name and ID.')); $this->assertTrue(current(taxonomy_vocabulary_load_multiple(array($vocabulary1->vid), array('name' => $vocabulary1->name))) == $vocabulary1, t('Vocabulary loaded successfully by name and ID.'));
// Fetch vocabulary 1 with specified node type.
drupal_static_reset('taxonomy_vocabulary_load_multiple');
$vocabulary_node_type = current(taxonomy_vocabulary_load_multiple(array($vocabulary1->vid), array('type' => 'article')));
$this->assertEqual($vocabulary_node_type, $vocabulary1, t('Vocabulary with specified node type loaded successfully.'));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment