$this->testPluginBase =
new TestPluginBase();
} /**
* Tests that the token replacement in views works correctly.
*/
public function testViewsTokenReplace() { $text = '{{ langcode__value }} means {{ langcode }}';
$tokens =
['{{ langcode }}' => Markup::
create('English'
), '{{ langcode__value }}' => 'en'
];
$result = \Drupal::
service('renderer'
)->
executeInRenderContext(new RenderContext(),
function D
) use ($text,
$tokens) { return $this->testPluginBase->
viewsTokenReplace($text,
$tokens);
});
$this->
assertSame('en means English',
$result);
} /**
* Tests that the token replacement in views works correctly with dots.
*/
public function testViewsTokenReplaceWithDots() { $text = '{{ argument.first }} comes before {{ argument.second }}';
$tokens =
['{{ argument.first }}' => 'first', '{{ argument.second }}' => 'second'
];