You are here

protected function ViewsCloneTest::createTerm in Views (for Drupal 7) 7.3

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

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

File

tests/views_clone.test, line 22

Class

ViewsCloneTest
Tests cloning a view.

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