You are here

function TaxonomyTest::testVocabularyTokens in Token 8

Test the additional vocabulary tokens.

File

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

Class

TaxonomyTest
Tests taxonomy tokens.

Namespace

Drupal\Tests\token\Kernel

Code

function testVocabularyTokens() {
  $vocabulary = $this->vocab;
  $tokens = [
    'machine-name' => 'tags',
    'edit-url' => Url::fromRoute('entity.taxonomy_vocabulary.edit_form', [
      'taxonomy_vocabulary' => $vocabulary
        ->id(),
    ], [
      'absolute' => TRUE,
    ])
      ->toString(),
  ];
  $this
    ->assertTokens('vocabulary', [
    'vocabulary' => $vocabulary,
  ], $tokens);
}