function TaxonomyWebTestCase::createTerm

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

24 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().
TaxonomyPrivateFileTestCase::testTaxonomyImageAccess in modules/taxonomy/taxonomy.test
Tests access to a private file on a taxonomy term entity.
TaxonomyQueryAlterTestCase::testTaxonomyQueryAlter in modules/taxonomy/taxonomy.test
Tests that appropriate tags are added when querying the database.

... See full list

File

modules/taxonomy/taxonomy.test, line 32

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.