public function testDelete() { $categoryId = 5; $parentId = 7; $this->request->expects($this->any())->method('getParam')->with('id')->willReturn($categoryId); $category = $this->getMock('Magento\\Catalog\\Model\\Category', ['getParentId', 'getPath'], [], '', false); $category->expects($this->once())->method('getParentId')->willReturn($parentId); $category->expects($this->once())->method('getPath')->willReturn('category-path'); $this->categoryRepository->expects($this->once())->method('get')->with($categoryId)->willReturn($category); $this->authStorage->expects($this->once())->method('setDeletedPath')->with('category-path'); $this->resultRedirect->expects($this->once())->method('setPath')->with('catalog/*/', ['_current' => true, 'id' => $parentId]); $this->unit->execute(); }
/** * {@inheritdoc} */ public function dispatch(\Magento\Framework\App\RequestInterface $request) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch'); if (!$pluginInfo) { return parent::dispatch($request); } else { return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo); } }
/** * {@inheritdoc} */ public function getResponse() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getResponse'); if (!$pluginInfo) { return parent::getResponse(); } else { return $this->___callPlugins('getResponse', func_get_args(), $pluginInfo); } }