Returns a new term with random properties in vocabulary $vid.
Drupal\taxonomy\Term The created taxonomy term.
protected function createTerm() {
$term = entity_create('taxonomy_term', array(
'name' => $this
->randomName(),
'description' => $this
->randomName(),
// Use the first available text format.
'format' => db_query_range('SELECT format FROM {filter_format}', 0, 1)
->fetchField(),
'vid' => $this->vocabulary->vid,
'langcode' => LANGUAGE_NOT_SPECIFIED,
));
$term
->save();
return $term;
}