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. 11.x 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 \Drupal\Core\Utility\Token[[api-linebreak]] @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.