minor #25970 [TwigBridge] update test for Twig performance optimizations (xabbuh)

This PR was merged into the 2.7 branch.

Discussion
----------

[TwigBridge] update test for Twig performance optimizations

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | twigphp/Twig#2617
| License       | MIT
| Doc PR        |

Commits
-------

21bbad9 update test for Twig performance optimizations
This commit is contained in:
Nicolas Grekas 2018-01-31 10:08:15 +01:00
commit c61f94122f

View File

@ -57,6 +57,10 @@ class TransNodeTest extends TestCase
protected function getVariableGetterWithStrictCheck($name)
{
if (Environment::VERSION_ID > 20404) {
return sprintf('(isset($context["%s"]) || array_key_exists("%1$s", $context) ? $context["%1$s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%1$s" does not exist.\', 0, $this->source); })())', $name);
}
if (Environment::MAJOR_VERSION >= 2) {
return sprintf('(isset($context["%s"]) || array_key_exists("%1$s", $context) ? $context["%1$s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%1$s" does not exist.\', 0, $this->getSourceContext()); })())', $name);
}