You are here

function ViewsHandlerRelationshipNodeTermDataTest::createTerm in Views (for Drupal 7) 7.3

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 23
Definition of ViewsHandlerRelationshipNodeTermDataTest.

Class

ViewsHandlerRelationshipNodeTermDataTest
Tests the relationship_node_term_data handler.

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