function it_renders_widgets_by_their_position(WidgetInterface $foo, WidgetInterface $bar, $registry, $templating) { $foo->getTemplate()->willReturn('foo:bar'); $foo->getParameters()->willReturn(['foo' => 'bar']); $bar->getTemplate()->willReturn('baz:qux'); $bar->getParameters()->willReturn(['baz' => 'qux']); $registry->getAll()->willReturn([1 => $bar, 5 => $foo]); $templating->render('foo:bar', ['foo' => 'bar'])->shouldBeCalled()->willReturn('<div>Foo</div>'); $templating->render('baz:qux', ['baz' => 'qux'])->shouldBeCalled()->willReturn('<p>Bar</p>'); $response = $this->listAction(); $response->shouldBeAnInstanceOf('Symfony\\Component\\HttpFoundation\\Response'); $response->getContent()->shouldReturn('<p>Bar</p><div>Foo</div>'); }
/** * Returns a rendered widget template * * @param WidgetInterface $widget * * @return string */ protected function renderWidget(WidgetInterface $widget) { return $this->templating->render($widget->getTemplate(), $widget->getParameters()); }