function HierarchicalTermFormatterTestCase::createTerm in Hierarchical Term Formatter 7
Returns a new term with random properties in vocabulary $vid.
1 call to HierarchicalTermFormatterTestCase::createTerm()
- HierarchicalTermFormatterTestCase::createHierarchy in ./
hierarchical_term_formatter.test - Create many terms in a hierarchy that allows testing the formatter display.
File
- ./
hierarchical_term_formatter.test, line 42 - Tests for Field Multiple Limit, based on examples from field.test
Class
- HierarchicalTermFormatterTestCase
- Test the field formatter settings work.
Code
function createTerm($parent = 0) {
$term = new stdClass();
$term->name = $this
->randomName();
if ($parent === 0) {
// Helps for debugging test.
$term->name .= " root";
}
$term->description = 'Term description is ' . $this
->randomName();
// Use the first available text format.
$term->format = db_query_range('SELECT format FROM {filter_format}', 0, 1)
->fetchField();
$term->vid = $this->vocabulary->vid;
$term->parent = $parent;
taxonomy_term_save($term);
return $term;
}