TestPluginBase example

/** * @var TestPluginBase */
  protected $testPluginBase;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $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);
    });
Home | Imprint | This part of the site doesn't use cookies.