Ejemplo n.º 1
0
 /**
  * @param array $definitions
  * @param bool $expects
  *
  * @dataProvider definitionDataProvider
  */
 public function testOnKernelRequest(array $definitions, $expects)
 {
     /** @var GetResponseEvent $event */
     $event = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent')->disableOriginalConstructor()->getMock();
     $this->widgetDefinitionsRegistry->expects($this->once())->method('getWidgetDefinitions')->will($this->returnValue(new ArrayCollection($definitions)));
     if ($expects) {
         $this->assetHelper->expects($this->exactly($expects))->method('getUrl')->with($this->isType('string'));
     }
     $this->handler->onKernelRequest($event);
 }
Ejemplo n.º 2
0
 public function testGetWidgetDefinitions()
 {
     $placement = 'left';
     $title = 'Foo';
     $definitions = new ArrayCollection();
     $definitions->set('test', array('title' => $title, 'icon' => 'test.ico', 'module' => 'widget/foo', 'placement' => 'left'));
     $this->widgetDefinitionsRegistry->expects($this->once())->method('getWidgetDefinitionsByPlacement')->with($placement)->will($this->returnValue($definitions));
     $this->translator->expects($this->once())->method('trans')->with($title)->will($this->returnValue('trans' . $title));
     $expected = array('test' => array('title' => 'transFoo', 'icon' => 'test.ico', 'module' => 'widget/foo', 'placement' => 'left'));
     $this->assertEquals($expected, $this->extension->getWidgetDefinitions($placement));
 }