You are here

function TaxonomyTest::addVocabulary in Token 8

File

tests/src/Kernel/TaxonomyTest.php, line 103

Class

TaxonomyTest
Tests taxonomy tokens.

Namespace

Drupal\Tests\token\Kernel

Code

function addVocabulary(array $vocabulary = []) {
  $vocabulary += [
    'name' => mb_strtolower($this
      ->randomMachineName(5)),
    'nodes' => [
      'article' => 'article',
    ],
  ];
  $vocabulary = Vocabulary::create($vocabulary)
    ->save();
  return $vocabulary;
}