diff --git a/tests/Node/MacroTest.php b/tests/Node/MacroTest.php index ef36774f7..f05adf636 100644 --- a/tests/Node/MacroTest.php +++ b/tests/Node/MacroTest.php @@ -36,8 +36,6 @@ class MacroTest extends NodeTestCase public function getTests() { - $tests = []; - $arguments = new Node([ 'foo' => new ConstantExpression(null, 1), 'bar' => new ConstantExpression('Foo', 1), @@ -46,7 +44,7 @@ class MacroTest extends NodeTestCase $body = new BodyNode([new TextNode('foo', 1)]); $node = new MacroNode('foo', $body, $arguments, 1); - $text[] = [$node, << [$node, <<env->getCharset()); + })(), false))) ? '' : new Markup(\$tmp, \$this->env->getCharset()); } EOF - , new Environment(new ArrayLoader()), + , new Environment(new ArrayLoader(), ['use_yield' => true]), ]; - return $tests; + yield 'with use_yield = false' => [$node, <<macros; + \$context = \$this->env->mergeGlobals([ + "foo" => \$__foo__, + "bar" => \$__bar__, + "varargs" => \$__varargs__, + ]); + + \$blocks = []; + + return ('' === \$tmp = \\Twig\\Extension\\CoreExtension::captureOutput((function () use (&\$context, \$macros, \$blocks) { + yield "foo"; + return; yield ''; + })())) ? '' : new Markup(\$tmp, \$this->env->getCharset()); +} +EOF + , new Environment(new ArrayLoader(), ['use_yield' => false]), + ]; } }