diff --git a/core/modules/views/src/Tests/Plugin/PluginBaseTest.php b/core/modules/views/src/Tests/Plugin/PluginBaseTest.php new file mode 100644 index 0000000..faa736f --- /dev/null +++ b/core/modules/views/src/Tests/Plugin/PluginBaseTest.php @@ -0,0 +1,68 @@ +testPluginBase = new TestPluginBase(); + } + + /** + * Test that the token replacement in views works correctly. + */ + public function testViewsTokenReplace() { + $text = '{{ langcode__value }} means {{ langcode }}'; + $tokens = [ '{{ langcode }}' => SafeString::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'); + } + + } + +} + +namespace Drupal\views\Plugin\views { + + /** + * Helper class for using the PluginBase abstract class. + */ + class TestPluginBase extends PluginBase { + + public function __construct() { + parent::__construct([], '', []); + } + + public function viewsTokenReplace($text, $tokens) { + return parent::viewsTokenReplace($text, $tokens); + } + + } + +}