public function PluginBaseTest::testViewsTokenReplace in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php \Drupal\Tests\views\Kernel\Plugin\PluginBaseTest::testViewsTokenReplace()
- 9 core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php \Drupal\Tests\views\Kernel\Plugin\PluginBaseTest::testViewsTokenReplace()
Tests 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
->assertSame('en means English', $result);
}