function it_renders_closure_with_container_without_arguments(ExporterInterface $export, StatementInterface $body, ContainerInterface $container) { $body->compile($export)->willReturn('return $argument1'); $container->getIterator()->willReturn(new \ArrayIterator([$body->getWrappedObject()])); $this->beConstructedWith([], $container); $this->compile($export)->shouldReturn("function () {\n return \$argument1;\n}"); }
function it_creates_closure_and_allows_to_specify_own_container(StatementInterface $argument, StatementInterface $body) { $export = new Exporter(); $body->compile($export)->willReturn('return 0'); $argument->compile($export)->willReturn('$argument'); $container = new Container([$body->getWrappedObject()]); $statement = $this->closure([$argument], $container); $statement->shouldHaveType('EcomDev\\Compiler\\Statement\\Closure'); $statement->compile($export)->shouldReturn("function (\$argument) {\n return 0;\n}"); }