function TaxonomyTest::addTerm in Token 8
2 calls to TaxonomyTest::addTerm()
- TaxonomyTest::testMultilingualTerms in tests/
src/ Kernel/ TaxonomyTest.php - Test the multilingual terms.
- TaxonomyTest::testTaxonomyTokens in tests/
src/ Kernel/ TaxonomyTest.php - Test the additional taxonomy term tokens.
File
- tests/
src/ Kernel/ TaxonomyTest.php, line 112
Class
- TaxonomyTest
- Tests taxonomy tokens.
Namespace
Drupal\Tests\token\KernelCode
function addTerm($vocabulary, array $term = []) {
$term += [
'name' => mb_strtolower($this
->randomMachineName(5)),
'vid' => $vocabulary
->id(),
];
$term = Term::create($term);
$term
->save();
return $term;
}