/** * {@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); } }
public function testExecuteWithException() { $this->request->expects($this->once())->method('getPost')->willReturn(null); $this->form->expects($this->once())->method('setInvisibleIgnored'); $this->form->expects($this->atLeastOnce())->method('extractData')->willReturn([]); $this->form->expects($this->never())->method('validateData'); $this->extensibleDataObjectConverter->expects($this->once())->method('toFlatArray')->willReturn([]); $validationResult = $this->getMockForAbstractClass('Magento\\Customer\\Api\\Data\\ValidationResultsInterface', [], '', false, true, true); $error = $this->getMock('Magento\\Framework\\Message\\Error', [], [], '', false); $error->expects($this->once())->method('getText')->willReturn('Error text'); $exception = $this->getMock('Magento\\Framework\\Validator\\Exception', [], [], '', false); $exception->expects($this->once())->method('getMessages')->willReturn([$error]); $validationResult->expects($this->once())->method('getMessages')->willThrowException($exception); $this->customerAccountManagement->expects($this->once())->method('validate')->willReturn($validationResult); $this->controller->execute(); }