1 taxonomy.test | TaxonomyWebTestCase::createTerm($vocabulary) |
Returns a new term with random properties in the given vocabulary.
File
- core/
modules/ taxonomy/ tests/ taxonomy.test, line 30 - Tests for taxonomy.module.
Class
- TaxonomyWebTestCase
- Provides common helper methods for Taxonomy module tests.
Code
function createTerm($vocabulary) {
$term = entity_create('taxonomy_term', array(
'name' => $this->randomName(),
'description' => $this->randomName(),
'format' => filter_default_format(),
'vocabulary' => $vocabulary->machine_name,
'langcode' => LANGUAGE_NONE,
));
taxonomy_term_save($term);
return $term;
}