You are here

function BlogAPITestCase::addVocabulary in Blog API 7

Add taxonomy vocabulary.

Parameters

string $vocab: Vocabulary name.

Return value

integer The vocab ID.

1 call to BlogAPITestCase::addVocabulary()
BlogAPITestCase::testBlogAPI in ./blogapi.test
Create, edit, and delete post; upload file; set/get categories.

File

./blogapi.test, line 142

Class

BlogAPITestCase

Code

function addVocabulary($vocab) {

  // 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;
}