summaryrefslogtreecommitdiff
path: root/modules/forum
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2008-10-12 01:01:44 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2008-10-12 01:01:44 +0000
commit72bbd21e5cb9f6eb585daf72503aa3afe01b9610 (patch)
treed73058b92d59f9b73cf3464219cb8bd30e1888b7 /modules/forum
parent430d83956928193245d22aba652e540060502a53 (diff)
downloadbrdo-72bbd21e5cb9f6eb585daf72503aa3afe01b9610.tar.gz
brdo-72bbd21e5cb9f6eb585daf72503aa3afe01b9610.tar.bz2
#312792 by catch: Clean-up for editForumTaxonomy().
Diffstat (limited to 'modules/forum')
-rw-r--r--modules/forum/forum.test40
1 files changed, 9 insertions, 31 deletions
diff --git a/modules/forum/forum.test b/modules/forum/forum.test
index 92f174eac..acad2096a 100644
--- a/modules/forum/forum.test
+++ b/modules/forum/forum.test
@@ -113,14 +113,11 @@ class ForumTestCase extends DrupalWebTestCase {
/**
* Edit the forum taxonomy.
- *
*/
function editForumTaxonomy() {
// Backup forum taxonomy.
$vid = variable_get('forum_nav_vocabulary', '');
- // This function returns NULL (the cache value is false).
-// $original_settings = taxonomy_vocabulary_load($vid);
- $original_settings = db_fetch_array(db_query('SELECT v.* FROM {vocabulary} v WHERE v.vid = %d', $vid));
+ $original_settings = taxonomy_vocabulary_load($vid);
// Generate a random name/description.
$title = $this->randomName(10);
@@ -134,41 +131,22 @@ class ForumTestCase extends DrupalWebTestCase {
);
// Edit the vocabulary.
- $this->drupalPost('admin/content/taxonomy/' . $vid . '/edit', $edit, t('Save'));
+ $this->drupalPost('admin/content/taxonomy/' . $vid, $edit, t('Save'));
$this->assertResponse(200);
$this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), t('Vocabulary was edited'));
// Grab the newly edited vocabulary.
- $cur_settings = db_fetch_array(db_query('SELECT v.* FROM {vocabulary} v WHERE v.vid = %d', $vid));
+ $current_settings = taxonomy_vocabulary_load($vid, TRUE);
// Make sure we actually edited the vocabulary properly.
- $this->assertTrue($cur_settings['name'] == $title, 'The name was updated');
- $this->assertTrue($cur_settings['description'] == $description, 'The description was updated');
-
- // Restore the name/description.
- $title = $original_settings['name'];
- $description = $original_settings['description'];
- $description = ($description == NULL) ? '' : $description;
-
- $edit = array(
- 'name' => $title,
- 'description' => $description,
- 'help' => '',
- 'weight' => -10
- );
+ $this->assertEqual($current_settings->name, $title, t('The name was updated'));
+ $this->assertEqual($current_settings->description, $description, t('The description was updated'));
- // Edit the vocabulary.
- $this->drupalPost('admin/content/taxonomy/' . $vid . 'edit', $edit, t('Save'));
- $this->assertResponse(200);
- $this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), t('Vocabulary was edited'));
-/*
- // Verify original forum taxonomy.
+ // Restore the original vocabulary.
$original_settings = (array) $original_settings;
- taxonomy_save_vocabulary($original_settings); // This fails because taxonomy_vocabulary_load returns NULL.
- $cur_settings = db_fetch_array(db_query('SELECT v.* FROM {vocabulary} v WHERE v.vid = %d', $vid));
- $this->assertTrue($cur_settings['name'] == $original_settings['name'], 'The name was restored');
- $this->assertTrue(!isset($cur_settings['description']), 'The description was restored');
-*/
+ taxonomy_save_vocabulary($original_settings);
+ $current_settings = taxonomy_vocabulary_load($vid, TRUE);
+ $this->assertEqual($current_settings->name, $original_settings['name'], 'The original vocabulary settings were restored');
}
/**