Skip to content

Commit 3ed1995

Browse files
committed
Updates tests
2 parents d0b018b + d37334b commit 3ed1995

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

app/code/community/Mollie/Mpm/controllers/ApiController.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,15 @@ public function paymentAction ()
144144
}
145145

146146
$order_id = $order->getId();
147-
$session = $this->_getCheckout();
148147

149148
try
150149
{
151150
// Magento is so awesome, we need to manually remember the quote
152-
$session->setMollieQuoteId($session->getQuoteId());
151+
$session = $this->_getCheckout();
152+
if (is_object($session))
153+
{
154+
$session->setMollieQuoteId($session->getQuoteId());
155+
}
153156

154157
// Assign required value's
155158
$amount = $this->getAmount($order);
@@ -380,7 +383,7 @@ protected function _restoreCart()
380383
{
381384
// Put items back in shopping cart
382385
$session = $this->_getCheckout();
383-
if ($quoteId = $session->getMollieQuoteId()) {
386+
if (is_object($session) && $quoteId = $session->getMollieQuoteId()) {
384387
$quote = Mage::getModel('sales/quote')->load($quoteId);
385388
if ($quote->getId()) {
386389
$quote->setIsActive(true)->save();

tests/unittests/Helper/ApiTest.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public function testCreatePaymentActionRequiresParameters()
6060
'description' => 'Description',
6161
'order_id' => 1,
6262
'redirect_url' => 'http://customer.local/redirect.php',
63-
'method' => 'Method'
63+
'method' => 'Method',
64+
'issuer' => '',
6465
);
6566

6667
foreach (array('amount', 'redirect_url') as $parameter)
@@ -83,7 +84,8 @@ public function testCreatePaymentActionFailureSetsErrorVariables()
8384
'Description',
8485
1,
8586
'incorrect.url/redirect.php',
86-
'Method'
87+
'Method',
88+
''
8789
);
8890

8991
$this->assertFalse($result);

tests/unittests/controllers/ApiControllerReportActionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function setUp()
8282
/*
8383
* Models.
8484
*/
85-
$this->payment_model = $this->getMock("Mage_Sales_Model_Order_Payment", array("setMethod", "setTransactionId", "setIsTransactionClosed", "addTransaction"));
85+
$this->payment_model = $this->getMock("Mage_Sales_Model_Order_Payment", array("setMethod", "setTransactionId", "setIsTransactionClosed", "addTransaction", "getTransaction"));
8686
$this->api_model = $this->getMock("Mollie_Mpm_Model_Api", array("updatePayment"), array(), "", FALSE);
8787
$this->order_model = $this->getMock("stdClass", array("load"));
8888

tests/unittests/controllers/ApiControllerReturnActionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function setUp()
8686
array("sales/order", $this->order_model),
8787
)));
8888

89-
$this->session = $this->getMock("stdClass", array("getQuote"));
89+
$this->session = $this->getMock("stdClass", array("getQuote", "getMollieQuoteId"));
9090
$this->quote = $this->getMock("stdClass");
9191

9292
$this->session->expects($this->any())

0 commit comments

Comments
 (0)