function TokenTest::setupSiteTokens

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Utility/TokenTest.php \Drupal\Tests\Core\Utility\TokenTest::setupSiteTokens()
  2. 11.x core/tests/Drupal/Tests/Core/Utility/TokenTest.php \Drupal\Tests\Core\Utility\TokenTest::setupSiteTokens()

Sets up the token library to return site tokens.

1 call to TokenTest::setupSiteTokens()
TokenTest::testReplacePlain in core/tests/Drupal/Tests/Core/Utility/TokenTest.php
@covers ::replacePlain

File

core/tests/Drupal/Tests/Core/Utility/TokenTest.php, line 347

Class

TokenTest
@coversDefaultClass \Drupal\Core\Utility\Token @group Utility

Namespace

Drupal\Tests\Core\Utility

Code

protected function setupSiteTokens() {
    // The site name is plain text, but the slogan is markup.
    $tokens = [
        '[site:name]' => 'Your <best> buys',
        '[site:slogan]' => Markup::Create('We are <b>best</b>'),
    ];
    $this->moduleHandler
        ->expects($this->any())
        ->method('invokeAll')
        ->willReturn($tokens);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.