function ViewsHandlerManyToOneTest::createTerm
Returns a new term with random properties.
Parameters
string $vocabulary: Vocabulary ID to create term in.
Return value
object Term with random properties.
1 call to ViewsHandlerManyToOneTest::createTerm()
- ViewsHandlerManyToOneTest::setUp in tests/
handlers/ views_handler_manytoone.test - Sets up a Drupal site for running functional and integration tests.
File
-
tests/
handlers/ views_handler_manytoone.test, line 72
Class
- ViewsHandlerManyToOneTest
- Tests the many to one helper handler class.
Code
protected 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;
}