You are here

function TaxonomyMenuWebTestCase::createNewTerm in Taxonomy menu 7

Create a new term record.

1 call to TaxonomyMenuWebTestCase::createNewTerm()
TaxonomyMenuWebTestCase::createTerm in ./taxonomy_menu.test
Returns a new term with random properties in vocabulary $vid.

File

./taxonomy_menu.test, line 51
Tests for taxonomy_menu.module.

Class

TaxonomyMenuWebTestCase
Class with common helper methods.

Code

function createNewTerm($vocabulary, $name = NULL, $parent = NULL) {
  $term = new stdClass();
  $term->name = $name === NULL ? $this
    ->randomName() : $name;
  $term->description = $this
    ->randomName();
  $term->format = $this
    ->getTextFormat();
  $term->vid = $vocabulary->vid;
  if ($parent !== NULL) {
    $term->parent = array(
      $parent->tid,
    );
  }
  return $term;
}