You are here

public function PluginBaseTest::testViewsTokenReplaceWithDots in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Plugin/PluginBaseTest.php \Drupal\views\Tests\Plugin\PluginBaseTest::testViewsTokenReplaceWithDots()

Test that the token replacement in views works correctly with dots.

File

core/modules/views/src/Tests/Plugin/PluginBaseTest.php, line 49
Contains \Drupal\views\Tests\Plugin\PluginBaseTest.

Class

PluginBaseTest
Tests the PluginBase class.

Namespace

Drupal\views\Tests\Plugin

Code

public function testViewsTokenReplaceWithDots() {
  $text = '{{ argument.first }} comes before {{ argument.second }}';
  $tokens = [
    '{{ argument.first }}' => 'first',
    '{{ argument.second }}' => 'second',
  ];
  $result = \Drupal::service('renderer')
    ->executeInRenderContext(new RenderContext(), function () use ($text, $tokens) {
    return $this->testPluginBase
      ->viewsTokenReplace($text, $tokens);
  });
  $this
    ->assertIdentical($result, 'first comes before second');
}