1.20.x taxonomy.test TaxonomyWebTestCase::createVocabulary()

Returns a new vocabulary with random properties.

File

modules/taxonomy/tests/taxonomy.test, line 15
Tests for taxonomy.module.

Class

TaxonomyWebTestCase
Provides common helper methods for Taxonomy module tests.

Code

function createVocabulary() {
  // Create a vocabulary.
  $vocabulary = new TaxonomyVocabulary(array(
    'name' => $this->randomName(),
    'description' => $this->randomName(),
    'machine_name' => backdrop_strtolower($this->randomName()),
    'weight' => mt_rand(0, 10),
  ));
  taxonomy_vocabulary_save($vocabulary);
  return $vocabulary;
}