Commit ec45fe5b authored by catch's avatar catch
Browse files

Issue #1401496 by bleen18: Fixed forum_taxonomy_term_delete() completely...

Issue #1401496 by bleen18: Fixed forum_taxonomy_term_delete() completely broken (takes  instead of  entity).
parent 3fa7d32a
...@@ -468,10 +468,10 @@ function forum_permission() { ...@@ -468,10 +468,10 @@ function forum_permission() {
/** /**
* Implements hook_taxonomy_term_delete(). * Implements hook_taxonomy_term_delete().
*/ */
function forum_taxonomy_term_delete($tid) { function forum_taxonomy_term_delete(stdClass $term) {
// For containers, remove the tid from the forum_containers variable. // For containers, remove the tid from the forum_containers variable.
$containers = variable_get('forum_containers', array()); $containers = variable_get('forum_containers', array());
$key = array_search($tid, $containers); $key = array_search($term->tid, $containers);
if ($key !== FALSE) { if ($key !== FALSE) {
unset($containers[$key]); unset($containers[$key]);
} }
......
...@@ -242,7 +242,7 @@ class ForumTestCase extends DrupalWebTestCase { ...@@ -242,7 +242,7 @@ class ForumTestCase extends DrupalWebTestCase {
// Save forum overview. // Save forum overview.
$this->drupalPost('admin/structure/forum/', array(), t('Save')); $this->drupalPost('admin/structure/forum/', array(), t('Save'));
$this->assertRaw(t('The configuration options have been saved.')); $this->assertRaw(t('The configuration options have been saved.'));
// Delete this second form. // Delete this second forum.
$this->deleteForum($this->delete_forum['tid']); $this->deleteForum($this->delete_forum['tid']);
// Create forum at the top (root) level. // Create forum at the top (root) level.
$this->root_forum = $this->createForum('forum'); $this->root_forum = $this->createForum('forum');
...@@ -341,6 +341,11 @@ class ForumTestCase extends DrupalWebTestCase { ...@@ -341,6 +341,11 @@ class ForumTestCase extends DrupalWebTestCase {
// Assert that the forum no longer exists. // Assert that the forum no longer exists.
$this->drupalGet('forum/' . $tid); $this->drupalGet('forum/' . $tid);
$this->assertResponse(404, 'The forum was not found'); $this->assertResponse(404, 'The forum was not found');
// Assert that the associated term has been removed from the
// forum_containers variable.
$containers = variable_get('forum_containers', array());
$this->assertFalse(in_array($tid, $containers), 'The forum_containers variable has been updated.');
} }
/** /**
......
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