/** * get the Admin links for this extension * * @return array */ private function getAdmin() { $links = []; if ($this->permissionApi->hasPermission('ZikulaBlocksModule::', '::', ACCESS_EDIT)) { $links[] = ['url' => $this->router->generate('zikulablocksmodule_admin_view'), 'text' => $this->translator->__('Blocks list'), 'icon' => 'table']; } if ($this->permissionApi->hasPermission('ZikulaBlocksModule::', '::', ACCESS_ADD)) { $links[] = ['url' => $this->router->generate('zikulablocksmodule_block_new'), 'text' => $this->translator->__('Create new block'), 'icon' => 'plus']; } if ($this->permissionApi->hasPermission('ZikulaBlocksModule::', '::', ACCESS_ADD)) { $links[] = ['url' => $this->router->generate('zikulablocksmodule_position_edit'), 'text' => $this->translator->__('Create new block position'), 'icon' => 'plus']; } if ($this->permissionApi->hasPermission('ZikulaBlocksModule::', '::', ACCESS_ADMIN)) { $links[] = ['url' => $this->router->generate('zikulablocksmodule_admin_config'), 'text' => $this->translator->__('Settings'), 'icon' => 'wrench']; } return $links; }
/** * @covers PermissionApi::accessLevelNames * @dataProvider accessLevelNamesProvider */ public function testAccessLevelNames($expectedText, $level) { $api = new PermissionApi($this->permRepo, $this->userRepo, $this->session, $this->translator); $this->assertEquals($expectedText, $api->accessLevelNames($level)); }