public function testPaymentCancelled() { $this->expectsOrderModelCanBeloaded(); $this->datahelper->expects($this->once())->method("getStatusById")->with(self::TRANSACTION_ID)->will($this->returnValue(array('bank_status' => Mollie_Mpm_Model_Api::STATUS_CANCELLED, 'updated_at' => '2014-04-26'))); $this->controller->expects($this->once())->method("_restoreCart"); $this->controller->expects($this->once())->method("_redirect")->with('checkout/onepage/failure', array('_secure' => true)); $this->controller->_construct(); $this->controller->returnAction(); }
public function testOrderLoadedByIncrementIdIfNoOrderIdInPost() { $this->expectOrderIdInRequestPresent(FALSE); $checkout = $this->getMock("stdClass", array("getLastRealOrderId")); $checkout->expects($this->once())->method("getLastRealOrderId")->will($this->returnValue(self::ORDER_INCREMENT_ID)); $this->controller->expects($this->atLeastOnce())->method("_getCheckout")->will($this->returnValue($checkout)); $this->order_model->expects($this->once())->method("loadByIncrementId")->with(self::ORDER_INCREMENT_ID)->will($this->throwException(new Test_Exception("STOP", 400))); // Stop testing from here on. $this->setExpectedException("Test_Exception", "STOP", 400); $this->controller->_construct(); $this->controller->paymentAction(); }
public function testExceptionThrownWhenCheckPaymentFails() { $this->expectsOrderModelCanBeloaded(TRUE); $this->expectOrderState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT); $this->expectsCheckPayment(FALSE); $this->api_helper->expects($this->once())->method("getErrorMessage")->will($this->returnValue("The flux capacitors are over capacity")); $exception = new Test_Exception(); $this->mage->expects($this->once())->method("throwException")->with("The flux capacitors are over capacity")->will($this->throwException($exception)); $this->mage->expects($this->once())->method("log")->with($exception)->will($this->throwException($exception)); // Throw it again, we don't want to test _showException here. $this->setExpectedException("Test_Exception"); $this->controller->_construct(); $this->controller->webhookAction(); }