/** * Validate duplicated ids * * @param $existedItems * @param $newItem * @dataProvider duplicateIdsProvider * @expectedException \InvalidArgumentException */ public function testValidateWithDuplicateIdsThrowsException($existedItems, $newItem) { foreach ($existedItems as $item) { $item = array_merge($item, $this->_params); $this->_model->validate($item); } $newItem = array_merge($newItem, $this->_params); $this->_model->validate($newItem); }
/** * @param Item\Validator $validator * @param \Magento\Framework\AuthorizationInterface $authorization * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Backend\Model\MenuFactory $menuFactory * @param \Magento\Backend\Model\UrlInterface $urlModel * @param \Magento\Framework\Module\ModuleListInterface $moduleList * @param \Magento\Framework\Module\Manager $moduleManager * @param array $data */ public function __construct(\Magento\Backend\Model\Menu\Item\Validator $validator, \Magento\Framework\AuthorizationInterface $authorization, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Backend\Model\MenuFactory $menuFactory, \Magento\Backend\Model\UrlInterface $urlModel, \Magento\Framework\Module\ModuleListInterface $moduleList, \Magento\Framework\Module\Manager $moduleManager, array $data = array()) { $this->_validator = $validator; $this->_validator->validate($data); $this->_moduleManager = $moduleManager; $this->_acl = $authorization; $this->_scopeConfig = $scopeConfig; $this->_menuFactory = $menuFactory; $this->_urlModel = $urlModel; $this->_moduleName = isset($data['module']) ? $data['module'] : 'Magento_Backend'; $this->_moduleList = $moduleList; $this->_id = $data['id']; $this->_title = $data['title']; $this->_action = $this->_getArgument($data, 'action'); $this->_resource = $this->_getArgument($data, 'resource'); $this->_dependsOnModule = $this->_getArgument($data, 'dependsOnModule'); $this->_dependsOnConfig = $this->_getArgument($data, 'dependsOnConfig'); $this->_tooltip = $this->_getArgument($data, 'toolTip', ''); }