/** * {@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); } }
/** * @param string $message * @param string $exception * * @dataProvider exceptionDataProvider */ public function testGeneralException($message, $exception) { $customerId = 1; $address = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\AddressInterface')->getMockForAbstractClass(); $currentCustomerMock = $this->getCurrentCustomerMock($customerId, $address); $newCustomerMock = $this->getNewCustomerMock($customerId, $address); $exception = new $exception(__($message)); $this->validator->expects($this->once())->method('validate')->with($this->request)->willReturn(true); $this->request->expects($this->once())->method('isPost')->willReturn(true); $this->request->expects($this->exactly(3))->method('getParam')->withConsecutive(['change_email'], ['change_email'], ['change_password'])->willReturn(false); $this->request->expects($this->any())->method('getPostValue')->willReturn(true); $this->customerSession->expects($this->once())->method('getCustomerId')->willReturn($customerId); $this->customerSession->expects($this->once())->method('setCustomerFormData')->with(true)->willReturnSelf(); $this->customerRepository->expects($this->once())->method('getById')->with($customerId)->willReturn($currentCustomerMock); $this->customerRepository->expects($this->once())->method('save')->with($newCustomerMock)->willThrowException($exception); $this->customerExtractor->expects($this->once())->method('extract')->with('customer_account_edit', $this->request)->willReturn($newCustomerMock); $this->resultRedirect->expects($this->once())->method('setPath')->with('*/*/edit')->willReturnSelf(); $this->assertSame($this->resultRedirect, $this->model->execute()); }