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(); }