function TaxonomyWebTestCase::createTerm
7.x taxonomy.test | TaxonomyWebTestCase::createTerm($vocabulary) |
Returns a new term with random properties in vocabulary $vid.
20 calls to TaxonomyWebTestCase::createTerm()
- RdfMappingDefinitionTestCase::testTaxonomyTermRdfaAttributes in drupal-7.x/
modules/ rdf/ rdf.test - Creates a random term and ensures the right RDFa markup is used.
- TaxonomyEFQTestCase::testTaxonomyEFQ in drupal-7.x/
modules/ taxonomy/ taxonomy.test - Tests that a basic taxonomy EntityFieldQuery works.
- TaxonomyLoadMultipleTestCase::testTaxonomyTermMultipleLoad in drupal-7.x/
modules/ taxonomy/ taxonomy.test - Create a vocabulary and some taxonomy terms, ensuring they're loaded correctly using taxonomy_term_load_multiple().
- TaxonomyRSSTestCase::testTaxonomyRSS in drupal-7.x/
modules/ taxonomy/ taxonomy.test - Tests that terms added to nodes are displayed in core RSS feed.
- TaxonomyTermFieldMultipleVocabularyTestCase::testTaxonomyTermFieldMultipleVocabularies in drupal-7.x/
modules/ taxonomy/ taxonomy.test - Tests term reference field and widget with multiple vocabularies.
File
- drupal-7.x/
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;
}