function TokenTest::testReplacePlain

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Utility/TokenTest.php \Drupal\Tests\Core\Utility\TokenTest::testReplacePlain()
  2. 10 core/tests/Drupal/Tests/Core/Utility/TokenTest.php \Drupal\Tests\Core\Utility\TokenTest::testReplacePlain()

@covers ::replacePlain

File

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

Class

TokenTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Utility%21Token.php/class/Token/11.x" title="Drupal placeholder/token replacement system." class="local">\Drupal\Core\Utility\Token</a> @group Utility

Namespace

Drupal\Tests\Core\Utility

Code

public function testReplacePlain() : void {
    $this->setupSiteTokens();
    $base = 'Wow, great "[site:name]" has a slogan "[site:slogan]"';
    $plain = $this->token
        ->replacePlain($base);
    $this->assertEquals($plain, 'Wow, great "Your <best> buys" has a slogan "We are best"');
}

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