Beispiel #1
0
 /**
  * @dataProvider menuProvider
  */
 public function testGetTabs($options, $tab, $tabOptions, $acl, $isDisplayed = true)
 {
     $child = $this->createMenuItem(null, $options);
     $child->expects($this->once())->method('isDisplayed')->will($this->returnValue($isDisplayed));
     $parent = $this->createMenuItem($child);
     $this->menuExtension->expects($this->once())->method('getMenu')->will($this->returnValue($parent));
     $this->router->expects($this->any())->method('generate')->will($this->returnCallback(function ($route, $options) {
         return $route . '?' . http_build_query($options);
     }));
     $this->securityFacade->expects($this->any())->method('isGranted')->will($this->returnCallback(function ($aclResource) use($acl) {
         return $acl[$aclResource];
     }));
     if (empty($options['label'])) {
         $this->translator->expects($this->never())->method('trans');
     } else {
         $this->translator->expects($this->once())->method('trans')->will($this->returnArgument(0));
     }
     $result = $this->extension->getTabs('menu', $tabOptions);
     $this->assertEquals($tab ? [$tab] : [], $result);
 }
 /**
  * {@inheritdoc}
  */
 public function getWidgets($object)
 {
     return $this->widgetProvider->getTabs($this->menuName, ['id' => $this->objectIdAccessor->getIdentifier($object)]);
 }