1 token.test TokenEntityTestCase::addTerm(TaxonomyVocabulary $vocabulary, array $term_parameters = array())

File

core/modules/simpletest/tests/token.test, line 824
Test integration for the token module.

Class

TokenEntityTestCase

Code

function addTerm(TaxonomyVocabulary $vocabulary, array $term_parameters = array()) {
  $term_parameters += array(
    'name' => backdrop_strtolower($this->randomName(5)),
    'vocabulary' => $vocabulary->machine_name,
    'parents' => array(0),
  );
  /** @var TaxonomyTerm $term */
  $term = entity_create('taxonomy_term', $term_parameters);
  $term->save();
  return $term;
}