minor #4749 Fix null-safe operator test (HypeMC)

This PR was merged into the 3.x branch.

Discussion
----------

Fix null-safe operator test

Noticed this while working on #4748.

Without `strict_variables`, the tests always pass, even when the null-safe operator is not used.

Commits
-------

a16ac6bd35 Fix null-safe operator test
This commit is contained in:
Fabien Potencier
2026-01-27 11:37:59 +01:00
+1 -1
View File
@@ -302,7 +302,7 @@ class ExpressionParserTest extends TestCase
*/
public function testNullSafeOperator($template, $data, $expected)
{
$env = new Environment(new ArrayLoader(['template' => $template]));
$env = new Environment(new ArrayLoader(['template' => $template]), ['strict_variables' => true]);
$this->assertSame($expected, $env->render('template', $data));
}