/** * @return void */ public function testExecuteWithException() { $customerId = 1; $phrase = new \Magento\Framework\Phrase('some error'); $this->requestMock->expects($this->once())->method('getParam')->with($this->equalTo('customer_id'))->will($this->returnValue($customerId)); $this->authenticationMock->expects($this->once())->method('unlock')->with($customerId)->willThrowException(new \Exception($phrase)); $this->messageManagerMock->expects($this->once())->method('addError'); $this->controller->execute(); }
/** * @return void */ public function testExecuteWithException() { $customerId = 1; $phrase = new \Magento\Framework\Phrase('some error'); $this->requestMock->expects($this->once())->method('getParam')->with($this->equalTo('customer_id'))->will($this->returnValue($customerId)); $this->customerRepositoryMock->expects($this->once())->method('getById')->with($customerId)->willReturn($this->customerDataMock); $this->accountManagementHelperMock->expects($this->once())->method('processUnlockData')->with($customerId)->willThrowException(new \Exception($phrase)); $this->messageManagerMock->expects($this->once())->method('addError'); $this->controller->execute(); }