Пример #1
0
 function it_registers_and_exposes_widgets(WidgetInterface $widget)
 {
     $widget->getAlias()->willReturn('foo');
     $this->add($widget, 1);
     $this->get('foo')->shouldReturn($widget);
     $this->getAll()->shouldReturn([1 => $widget]);
 }
 function it_provides_data_to_widgets(WidgetInterface $foo, $registry)
 {
     $foo->getData()->willReturn(['bar' => 'baz']);
     $registry->get('foo')->willReturn($foo);
     $response = $this->dataAction('foo');
     $response->shouldBeAnInstanceOf('Symfony\\Component\\HttpFoundation\\JsonResponse');
     $response->getContent()->shouldReturn('{"bar":"baz"}');
 }
 /**
  * Returns a rendered widget template
  *
  * @param WidgetInterface $widget
  *
  * @return string
  */
 protected function renderWidget(WidgetInterface $widget)
 {
     return $this->templating->render($widget->getTemplate(), $widget->getParameters());
 }