public function ViewsHooksTest::testViewsPreRenderViewsFormViewsForm in Drupal 8
Tests views_pre_render_views_form_views_form() deprecation.
@group legacy
@expectedDeprecation views_pre_render_views_form_views_form() is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Use \Drupal\views\Form\ViewsFormMainForm::preRenderViewsForm() instead. See https://www.drupal.org/node/2966725
File
- core/
modules/ views/ tests/ src/ Kernel/ ViewsHooksTest.php, line 126
Class
- ViewsHooksTest
- Tests that views hooks are registered when defined in $module.views.inc.
Namespace
Drupal\Tests\views\KernelCode
public function testViewsPreRenderViewsFormViewsForm() {
$element = [
'output' => [
'#plain_text' => '<!--will-be-escaped--><!--will-be-not-escaped-->',
],
'#substitutions' => [
'#value' => [],
],
];
$element = \Drupal::service('renderer')
->executeInRenderContext(new RenderContext(), function () use ($element) {
return views_pre_render_views_form_views_form($element);
});
$this
->setRawContent((string) $element['output']['#markup']);
$this
->assertEscaped('<em>escaped</em>');
$this
->assertRaw('<em>unescaped</em>');
}