public function PluginBaseTest::testViewsTokenReplace in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Plugin/PluginBaseTest.php \Drupal\views\Tests\Plugin\PluginBaseTest::testViewsTokenReplace()
Test that the token replacement in views works correctly.
File
- core/
modules/ views/ src/ Tests/ Plugin/ PluginBaseTest.php, line 35 - Contains \Drupal\views\Tests\Plugin\PluginBaseTest.
Class
- PluginBaseTest
- Tests the PluginBase class.
Namespace
Drupal\views\Tests\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');
}