static::
assertEquals('bar',
$rendered);
} public function testInitialization(): void
{ $templateMock = '{{ testDate|format_date(pattern="HH:mm") }}';
$testDate =
new \
DateTimeImmutable('now',
new \
DateTimeZone('UTC'
));
$context = Context::
createDefaultContext();
$renderedTime =
$this->stringTemplateRenderer->
render($templateMock,
['testDate' =>
$testDate],
$context);
/** @var CoreExtension $coreExtension */
$coreExtension =
$this->twig->
getExtension(CoreExtension::
class);
$coreExtension->
setTimezone('Europe/Berlin'
);
$this->stringTemplateRenderer->
initialize();
$renderedWithTimezone =
$this->stringTemplateRenderer->
render($templateMock,
['testDate' =>
$testDate],
$context);
static::
assertNotEquals($renderedTime,
$renderedWithTimezone);
}}