Esempio n. 1
0
 /**
  * Test saveAction when was credit memo total is not positive
  */
 public function testSaveActionWithNegativeCreditmemo()
 {
     $data = array('comment_text' => '');
     $this->_requestMock->expects($this->once())->method('getPost')->with('creditmemo')->will($this->returnValue($data));
     $this->_requestMock->expects($this->any())->method('getParam')->will($this->returnValue(null));
     $creditmemoMock = $this->getMock('Magento\\Sales\\Model\\Order\\Creditmemo', array('load', 'getGrandTotal', 'getAllowZeroGrandTotal', '__wakeup'), array(), '', false);
     $creditmemoMock->expects($this->once())->method('getGrandTotal')->will($this->returnValue('0'));
     $creditmemoMock->expects($this->once())->method('getAllowZeroGrandTotal')->will($this->returnValue(false));
     $this->memoLoaderMock->expects($this->once())->method('load')->will($this->returnValue($creditmemoMock));
     $this->_setSaveActionExpectationForMageCoreException($data, 'Credit memo\'s total must be positive.');
     $this->_controller->execute();
 }
Esempio n. 2
0
 /**
  * Test saveAction when was credit memo total is not positive
  */
 public function testSaveActionWithNegativeCreditmemo()
 {
     $data = ['comment_text' => ''];
     $this->_requestMock->expects($this->once())->method('getPost')->with('creditmemo')->will($this->returnValue($data));
     $this->_requestMock->expects($this->any())->method('getParam')->will($this->returnValue(null));
     $creditmemoMock = $this->getMock('Magento\\Sales\\Model\\Order\\Creditmemo', ['load', 'getGrandTotal', 'getAllowZeroGrandTotal', '__wakeup'], [], '', false);
     $creditmemoMock->expects($this->once())->method('getGrandTotal')->will($this->returnValue('0'));
     $creditmemoMock->expects($this->once())->method('getAllowZeroGrandTotal')->will($this->returnValue(false));
     $this->memoLoaderMock->expects($this->once())->method('load')->will($this->returnValue($creditmemoMock));
     $this->resultRedirectFactoryMock->expects($this->once())->method('create')->willReturn($this->resultRedirectMock);
     $this->resultRedirectMock->expects($this->once())->method('setPath')->with('sales/*/new', ['_current' => true])->willReturnSelf();
     $this->_setSaveActionExpectationForMageCoreException($data, 'The credit memo\'s total must be positive.');
     $this->_controller->execute();
 }