You are here

function TaxonomyWebTestCase::createTerm in Drupal 7

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

21 calls to TaxonomyWebTestCase::createTerm()
RdfMappingDefinitionTestCase::testTaxonomyTermRdfaAttributes in modules/rdf/rdf.test
Creates a random term and ensures the right RDFa markup is used.
TaxonomyEFQTestCase::testTaxonomyEFQ in modules/taxonomy/taxonomy.test
Tests that a basic taxonomy EntityFieldQuery works.
TaxonomyLoadMultipleTestCase::testTaxonomyTermMultipleLoad in modules/taxonomy/taxonomy.test
Create a vocabulary and some taxonomy terms, ensuring they're loaded correctly using taxonomy_term_load_multiple().
TaxonomyQueryAlterTestCase::testTaxonomyQueryAlter in modules/taxonomy/taxonomy.test
Tests that appropriate tags are added when querying the database.
TaxonomyRSSTestCase::testTaxonomyRSS in modules/taxonomy/taxonomy.test
Tests that terms added to nodes are displayed in core RSS feed.

... See full list

File

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