Esempio n. 1
0
 public function testSaveActionWithException()
 {
     $this->formKeyValidatorMock->expects($this->once())->method('validate')->will($this->returnValue(true));
     $this->customerSessionMock->expects($this->any())->method('getCustomerId')->will($this->returnValue(1));
     $this->customerRepositoryMock->expects($this->any())->method('getById')->will($this->throwException(new NoSuchEntityException(__(NoSuchEntityException::MESSAGE_SINGLE_FIELD, ['fieldName' => 'customerId', 'value' => 'value']))));
     $this->redirectMock->expects($this->once())->method('redirect')->with($this->responseMock, 'customer/account/', []);
     $this->messageManagerMock->expects($this->never())->method('addSuccess');
     $this->messageManagerMock->expects($this->once())->method('addError')->with('Something went wrong while saving your subscription.');
     $this->action->executeInternal();
 }