public function testExecuteAgreementStatusDoesNotAllowToCancel() { $this->_agreement->expects($this->once())->method('canCancel')->will($this->returnValue(false)); $this->_agreement->expects($this->never())->method('cancel'); $this->_session->expects($this->once())->method('getCustomerId')->will($this->returnValue(871)); $this->_messageManager->expects($this->never())->method('addNoticeMessage'); $this->_messageManager->expects($this->never())->method('addErrorMessage'); $this->_registry->expects($this->once())->method('register')->with('current_billing_agreement', $this->identicalTo($this->_agreement)); $this->_controller->execute(); }