'cache' => FALSE,
'autoescape' => 'html',
'optimizations' => 0,
]);
// By default, TwigExtension will attempt to cast objects to strings.
// Ensure objects that implement MarkupInterface are unchanged.
$safe_string =
$this->
createMock('\Drupal\Component\Render\MarkupInterface'
);
$this->
assertSame($safe_string,
$this->systemUnderTest->
escapeFilter($twig,
$safe_string, 'html', 'UTF-8', TRUE
));
// Ensure objects that do not implement MarkupInterface are escaped.
$string_object =
new TwigExtensionTestString("<script>alert('here');</script>"
);
$this->
assertSame('<script>alert('here');</script>',
$this->systemUnderTest->
escapeFilter($twig,
$string_object, 'html', 'UTF-8', TRUE
));
} /**
* @covers ::safeJoin
*/
public function testSafeJoin() { $this->renderer->
expects($this->
any()) ->
method('render'
) ->
with(['#markup' => '<strong>will be rendered</strong>', '#printed' => FALSE
]) ->
willReturn('<strong>will be rendered</strong>'
);