My purpose is to sandbox a generated html.
$loader = new \Twig\Loader\ArrayLoader([
'test1.html.twig' => $this->getMessageObject()->getBody()
]);
$twig = new \Twig\Environment($loader);
$output = "{% sandbox %}{% include ("'.$twig->getLoader()->getSourceContext('test1.html.twig')->getPath().'") %} {% endsandbox %}"
I'm not able to get any path results from getPath() method. It's empty string.