function ViewsHandlerRelationshipNodeTermDataTest::createTerm

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

1 call to ViewsHandlerRelationshipNodeTermDataTest::createTerm()
ViewsHandlerRelationshipNodeTermDataTest::setUp in tests/taxonomy/views_handler_relationship_node_term_data.test
Sets up a Drupal site for running functional and integration tests.

File

tests/taxonomy/views_handler_relationship_node_term_data.test, line 27

Class

ViewsHandlerRelationshipNodeTermDataTest
Tests the relationship_node_term_data handler.

Code

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