You are here

public function TokenTest::testReplaceEscaping in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Utility/TokenTest.php \Drupal\Tests\Core\Utility\TokenTest::testReplaceEscaping()

@covers ::replace @dataProvider providerTestReplaceEscaping

File

core/tests/Drupal/Tests/Core/Utility/TokenTest.php, line 271
Contains \Drupal\Tests\Core\Utility\TokenTest.

Class

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

Namespace

Drupal\Tests\Core\Utility

Code

public function testReplaceEscaping($string, array $tokens, $expected) {
  $this->moduleHandler
    ->expects($this
    ->any())
    ->method('invokeAll')
    ->willReturnCallback(function ($type, $args) {
    return $args[2]['tokens'];
  });
  $result = $this->token
    ->replace($string, [
    'tokens' => $tokens,
  ]);
  $this
    ->assertInternalType('string', $result);
  $this
    ->assertEquals($expected, $result);
}