public function PluginBaseTest::testViewsTokenReplace in Drupal 8
Same name and namespace in other branches
- 9 core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php \Drupal\Tests\views\Kernel\Plugin\PluginBaseTest::testViewsTokenReplace()
Test that the token replacement in views works correctly.
File
- core/
modules/ views/ tests/ src/ Kernel/ Plugin/ PluginBaseTest.php, line 35 - Contains \Drupal\views\Tests\Plugin\PluginBaseTest.
Class
- PluginBaseTest
- Tests the PluginBase class.
Namespace
Drupal\Tests\views\Kernel\PluginCode
public function testViewsTokenReplace() {
$text = '{{ langcode__value }} means {{ langcode }}';
$tokens = [
'{{ langcode }}' => Markup::create('English'),
'{{ langcode__value }}' => 'en',
];
$result = \Drupal::service('renderer')
->executeInRenderContext(new RenderContext(), function () use ($text, $tokens) {
return $this->testPluginBase
->viewsTokenReplace($text, $tokens);
});
$this
->assertIdentical($result, 'en means English');
}