'table' => 'views_test_data',
'field' => 'name',
'relationship' => 'none',
'alter' =>
[ 'text' => 'Amount of kittens: {{ age }}',
],
],
]);
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::
service('renderer'
);
$preview =
$view->
preview();
$output =
$renderer->
renderRoot($preview);
$expected_text = 'Amount of kittens: ' .
$view->style_plugin->
getField(0, 'age'
);
$this->
assertStringContainsString($expected_text,
(string) $output, 'The views token has been successfully replaced.'
);
} /**
* Ensure that custom field content is XSS filtered.
*/
public function testCustomFieldXss() { $view = Views::
getView('test_view'
);