Commit dc82bc5a authored by Dries's avatar Dries

- Patch #341872 by mayer, catch: fixed bug in database conversion and added a...

- Patch #341872 by mayer, catch: fixed bug in database conversion and added a missing test for taxonomy_term_save().
parent 424aaef4
......@@ -334,7 +334,9 @@ function taxonomy_term_save($term) {
$status = drupal_write_record('term_data', $term);
module_invoke_all('taxonomy_term_update', $term);
}
db_delete('term_relation')->condition('tid1', $term->tid, 'OR')->condition('tid2', $term->tid)->execute();
$or = db_or()->condition('tid1', $term->tid)->condition('tid2', $term->tid);
db_delete('term_relation')->condition($or)->execute();
if (!empty($term->relations)) {
foreach ($term->relations as $related_id) {
......
......@@ -268,9 +268,16 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
$edit = array();
$edit['relations[]'] = $term2->tid;
$this->drupalPost('taxonomy/term/' . $term1->tid . '/edit', $edit, t('Save'));
$related = taxonomy_get_related($term1->tid);
$this->assertTrue(isset($related[$term2->tid]), t('Related term was found'));
// Create a third term.
$term3 = $this->createTerm($this->vocabulary->vid);
$edit['relations[]'] = $term3->tid;
$this->drupalPost('taxonomy/term/' . $term1->tid . '/edit', $edit, t('Save'));
$related = taxonomy_get_related($term1->tid);
$this->assertTrue(isset($related[$term3->tid]), t('Related term was found'));
$this->assertFalse(isset($related[$term2->tid]), t('Term relationship no longer exists'));
}
/**
......
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