diff --git a/core/modules/views/src/Tests/Handler/FieldUnitTest.php b/core/modules/views/src/Tests/Handler/FieldUnitTest.php
index 373730b..85fabe3 100644
--- a/core/modules/views/src/Tests/Handler/FieldUnitTest.php
+++ b/core/modules/views/src/Tests/Handler/FieldUnitTest.php
@@ -258,7 +258,9 @@ public function testFieldTokens() {
$job_field->options['alter']['text'] = '
{{ job }}
';
$random_text = $this->randomMachineName();
$job_field->setTestValue('' . $random_text . '');
- $output = $job_field->advancedRender($row);
+ $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($job_field, $row) {
+ return $job_field->advancedRender($row);
+ });
$this->assertEqual($output, '<span>' . $random_text . '</span>
', 'Valid tags are allowed in rewrite templates and token replacements.');
// Verify ';
$job_field->options['alter']['text'] = $rewrite_template;
$random_text = $this->randomMachineName();
$job_field->setTestValue($random_text);
- $output = $job_field->advancedRender($row);
+ $output = $renderer->executeInRenderContext(new RenderContext(), function () use ($job_field, $row) {
+ return $job_field->advancedRender($row);
+ });
$this->assertEqual($output, $random_text, format_string('Make sure a script tag in the template (!template) is removed, leaving only the replaced token in the output (!output)', [
'!output' => $output,
'!template' => $rewrite_template,