Returns a new term with random properties in vocabulary $vid.
Drupal\taxonomy\Term The created taxonomy term.
protected function createTerm() {
$filter_formats = filter_formats();
$format = array_pop($filter_formats);
$term = entity_create('taxonomy_term', array(
'name' => $this
->randomName(),
'description' => $this
->randomName(),
// Use the first available text format.
'format' => $format->format,
'vid' => $this->vocabulary
->id(),
'langcode' => Language::LANGCODE_NOT_SPECIFIED,
));
$term
->save();
return $term;
}