function TaxonomyWebTestCase::createTerm

Returns a new term with random properties in vocabulary $vid.

21 calls to TaxonomyWebTestCase::createTerm()

File

drupal/modules/taxonomy/taxonomy.test, line 32
Tests for taxonomy.module.

Class

TaxonomyWebTestCase
Provides common helper methods for Taxonomy module tests.

Code

function createTerm($vocabulary) {
  $term = new stdClass();
  $term->name = $this
    ->randomName();
  $term->description = $this
    ->randomName();

  // Use the first available text format.
  $term->format = db_query_range('SELECT format FROM {filter_format}', 0, 1)
    ->fetchField();
  $term->vid = $vocabulary->vid;
  taxonomy_term_save($term);
  return $term;
}