function DefaultViewsTest::createTerm in Views (for Drupal 7) 8.3
Returns a new term with random properties in vocabulary $vid.
1 call to DefaultViewsTest::createTerm()
- DefaultViewsTest::setUp in lib/
Drupal/ views/ Tests/ DefaultViewsTest.php - Sets up a Drupal site for running functional and integration tests.
File
- lib/
Drupal/ views/ Tests/ DefaultViewsTest.php, line 151 - Definition of Drupal\views\Tests\DefaultViewsTest.
Class
- DefaultViewsTest
- Tests for views default views.
Namespace
Drupal\views\TestsCode
function createTerm($vocabulary) {
$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' => $vocabulary->vid,
'langcode' => LANGUAGE_NOT_SPECIFIED,
));
taxonomy_term_save($term);
return $term;
}