Skip to content

Commit

Permalink
Added a test
Browse files Browse the repository at this point in the history
  • Loading branch information
michielgerritsen committed Apr 29, 2019
1 parent afb0fee commit ee69266
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions app/code/community/Mollie/Mpm/Test/Model/Client/OrdersTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

class Mollie_Mpm_Test_Model_Client_OrdersTest extends Mollie_Mpm_Test_TestHelpers_TestCase
{
public function testUsesTheCorrectApiToResumeTheTransaction()
{
$apiMock = $this->createMock('\Mollie\Api\MollieApiClient');
$ordersApiMock = $this->createMock('\Mollie\Api\Endpoints\OrderEndpoint');
$apiMock->orders = $ordersApiMock;

// Make sure the right API is called.
$ordersApiMock->expects($this->once())->method('get')->willReturn(new \Mollie\Api\Resources\Order($apiMock));

$mollieHelperMock = $this->getHelper('mpm');
$mollieHelperMock->method('getMollieAPI')->willReturn($apiMock);

$order = $this->getMockBuilder('Mage_Sales_Model_Order')
->setMethods(['getMollieTransactionId', 'getPayment'])
->getMock();

$order->method('getMollieTransactionId')->willReturn(123);
$order->method('getPayment')->willReturn(new Mage_Sales_Model_Order_Payment);

$instance = new Mollie_Mpm_Model_Client_Orders();
$instance->startTransaction($order);
}
}

0 comments on commit ee69266

Please sign in to comment.