Also apply scope conversion to short PHP tags

This commit is contained in:
Kijin Sung 2023-10-20 21:03:31 +09:00
parent 55d91b9dc7
commit a284a1b072
2 changed files with 19 additions and 2 deletions

View file

@ -1036,6 +1036,16 @@ class TemplateParserV2Test extends \Codeception\Test\Unit
$target = '<?php $__Context->foo = 42; ?>';
$this->assertEquals($target, $this->_parse($source));
// Short PHP tags
$source = '<? foo($bar); ?>';
$target = '<?php foo($__Context->bar); ?>';
$this->assertEquals($target, $this->_parse($source));
// Short PHP echo tags
$source = '<?=$foo?>';
$target = '<?php echo $__Context->foo ?>';
$this->assertEquals($target, $this->_parse($source));
// XE-style {@ ... } notation
$source = '{@ $foo = 42; }';
$target = '<?php $__Context->foo = 42; ?>';