summaryrefslogtreecommitdiff
path: root/modules/taxonomy
diff options
context:
space:
mode:
Diffstat (limited to 'modules/taxonomy')
-rw-r--r--modules/taxonomy/taxonomy.admin.inc2
-rw-r--r--modules/taxonomy/taxonomy.module4
-rw-r--r--modules/taxonomy/taxonomy.test12
3 files changed, 13 insertions, 5 deletions
diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc
index 3ba26135e..3d9bd5092 100644
--- a/modules/taxonomy/taxonomy.admin.inc
+++ b/modules/taxonomy/taxonomy.admin.inc
@@ -837,7 +837,7 @@ function taxonomy_term_confirm_delete(&$form_state, $tid) {
* @see taxonomy_term_confirm_delete()
*/
function taxonomy_term_confirm_delete_submit($form, &$form_state) {
- taxonomy_del_term($form_state['values']['tid']);
+ taxonomy_term_delete($form_state['values']['tid']);
taxonomy_check_vocabulary_hierarchy($form['#vocabulary'], $form_state['values']);
drupal_set_message(t('Deleted term %name.', array('%name' => $form_state['values']['name'])));
watchdog('taxonomy', 'Deleted term %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE);
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 4e25c3bd8..b28e0a306 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -765,8 +765,8 @@ function taxonomy_get_parents($tid, $key = 'tid') {
*/
function taxonomy_get_parents_all($tid) {
$parents = array();
- if ($tid) {
- $parents[] = taxonomy_term_load($tid);
+ if ($term = taxonomy_term_load($tid)) {
+ $parents[] = $term;
$n = 0;
while ($parent = taxonomy_get_parents($parents[$n]->tid)) {
$parents = array_merge($parents, $parent);
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index 0047e36ab..b4ab8880c 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -390,9 +390,9 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
}
/**
- * Save and edit a term and assert that the name and description are correct.
+ * Save, edit and delete a term using the user interface.
*/
- function testTermEdit() {
+ function testTermInterface() {
$edit = array(
'name' => $this->randomName(12),
'description' => $this->randomName(100),
@@ -431,6 +431,14 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
$this->drupalGet('taxonomy/term/' . $term[0]->tid);
$this->assertText($edit['name'], t('The randomly generated term name is present.'));
$this->assertText($edit['description'], t('The randomly generated term description is present.'));
+
+ // Delete the term.
+ $this->drupalPost('taxonomy/term/' . $term[0]->tid . '/edit', array(), t('Delete'));
+ $this->drupalPost(NULL, NULL, t('Delete'));
+
+ // Assert that the term no longer exists.
+ $this->drupalGet('taxonomy/term/' . $term[0]->tid);
+ $this->assertResponse(404, t('The taxonomy term page was not found'));
}
}