$markup =
$markup->
reveal();
$items =
[ '<em>will be escaped</em>',
$markup,
['#markup' => '<strong>will be rendered</strong>'
],
];
$result =
$this->systemUnderTest->
safeJoin($twig_environment,
$items, '<br/>'
);
$this->
assertEquals('<em>will be escaped</em><br/><em>will be markup</em><br/><strong>will be rendered</strong>',
$result);
// Ensure safe_join Twig filter supports Traversable variables.
$items =
new \
ArrayObject([ '<em>will be escaped</em>',
$markup,
['#markup' => '<strong>will be rendered</strong>'
],
]);
$result =
$this->systemUnderTest->
safeJoin($twig_environment,
$items, ', '
);
$this->
assertEquals('<em>will be escaped</em>, <em>will be markup</em>, <strong>will be rendered</strong>',
$result);
// Ensure safe_join Twig filter supports empty variables.
$items = NULL;
$result =
$this->systemUnderTest->
safeJoin($twig_environment,
$items, '<br>'
);
$this->
assertEmpty($result);
}