diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-06-12 13:59:56 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-06-12 13:59:56 +0000 |
commit | 2bc9e50dbaa83df96090172b3fc682bd9a291588 (patch) | |
tree | e698368b8fa1a11e46f47924f76fbd4a526648f5 /modules/blogapi | |
parent | d0936908cbf2f8b6c873e9b4d5a2abe279eb8ab7 (diff) | |
download | brdo-2bc9e50dbaa83df96090172b3fc682bd9a291588.tar.gz brdo-2bc9e50dbaa83df96090172b3fc682bd9a291588.tar.bz2 |
- Patch #413192 by catch et al: make taxonomy terms fieldable (not to be confused with taxonomy terms as fields).
Diffstat (limited to 'modules/blogapi')
-rw-r--r-- | modules/blogapi/blogapi.test | 53 |
1 files changed, 17 insertions, 36 deletions
diff --git a/modules/blogapi/blogapi.test b/modules/blogapi/blogapi.test index 57404d283..4ca1ad15d 100644 --- a/modules/blogapi/blogapi.test +++ b/modules/blogapi/blogapi.test @@ -112,24 +112,17 @@ class BlogAPITestCase extends DrupalWebTestCase { * The vocab ID. */ function addVocabulary($vocab) { - $edit = array(); - $edit['name'] = $vocab; - $edit['nodes[blog]'] = TRUE; - $this->drupalPost('admin/content/taxonomy/add', $edit, t('Save')); - $this->assertRaw(t('Created new vocabulary %vocab.', array('%vocab' => $edit['name'])), t('Taxonomy vocabulary added.')); - - $vocab_arr = taxonomy_get_vocabularies(); - $vid = NULL; - foreach ($vocab_arr as $vocab_item) { - if ($vocab_item->name == $vocab) { - $vid = $vocab_item->vid; - break; - } - } - - $this->assertNotNull($vid, t('Vocabulary found in database.')); - - return $vid; + // Create a vocabulary. + $vocabulary = new stdClass(); + $vocabulary->name = $vocab; + $vocabulary->description = $this->randomName(); + $vocabulary->machine_name = $this->randomName(); + $vocabulary->help = ''; + $vocabulary->nodes = array('blog' => 'blog'); + $vocabulary->weight = mt_rand(0, 10); + taxonomy_vocabulary_save($vocabulary); + + return $vocabulary->vid; } /** @@ -142,23 +135,11 @@ class BlogAPITestCase extends DrupalWebTestCase { * @return integer * The Term ID. */ - function addTerm($vid, $term) { - $edit = array(); - $edit['name'] = $term; - $this->drupalPost('admin/content/taxonomy/' . $vid . '/add', $edit, t('Save')); - $this->assertRaw(t('Created new term %term.', array('%term' => $edit['name'])), t('Taxonomy term added.')); - - $tree = taxonomy_get_tree($vid); - $tid = NULL; - foreach ($tree as $tree_term) { - if ($tree_term->name == $term) { - $tid = $tree_term->tid; - break; - } - } - - $this->assertNotNull($tid, t('Term found in database.')); - - return $tid; + function addTerm($vid, $term_name) { + $term = new stdClass(); + $term->name = $term_name; + $term->vid = $vid; + taxonomy_term_save($term); + return $term->tid; } } |