Skip to content

Commit

Permalink
MAG2-302 - Fixed unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FatchipRobert committed Dec 14, 2023
1 parent a9b8566 commit 503e34a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Test/Unit/Model/Methods/AmazonPayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use Magento\Payment\Model\Info;
use Payone\Core\Model\Api\Request\Authorization;
use Magento\Framework\Exception\LocalizedException;
use Magento\Sales\Model\Order\Payment;

class AmazonPayTest extends BaseTestCase
{
Expand Down Expand Up @@ -156,8 +157,12 @@ public function testAuthorize()
$store = $this->getMockBuilder(Store::class)->disableOriginalConstructor()->getMock();
$store->method('getCode')->willReturn('test');

$payment = $this->getMockBuilder(Payment::class)->disableOriginalConstructor()->getMock();
$payment->method('getAdditionalInformation')->willReturn([]);

$order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
$order->method('getStore')->willReturn($store);
$order->method('getPayment')->willReturn($payment);

$paymentInfo = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock();
$paymentInfo->method('getOrder')->willReturn($order);
Expand Down
5 changes: 5 additions & 0 deletions Test/Unit/Model/Methods/BarzahlenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use Magento\Payment\Model\Info;
use Payone\Core\Test\Unit\BaseTestCase;
use Payone\Core\Test\Unit\PayoneObjectManager;
use Magento\Sales\Model\Order\Payment;

class BarzahlenTest extends BaseTestCase
{
Expand Down Expand Up @@ -85,8 +86,12 @@ public function testAuthorize()
$store = $this->getMockBuilder(Store::class)->disableOriginalConstructor()->getMock();
$store->method('getCode')->willReturn('test');

$payment = $this->getMockBuilder(Payment::class)->disableOriginalConstructor()->getMock();
$payment->method('getAdditionalInformation')->willReturn([]);

$order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
$order->method('getStore')->willReturn($store);
$order->method('getPayment')->willReturn($payment);

$paymentInfo = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock();
$paymentInfo->method('getOrder')->willReturn($order);
Expand Down
9 changes: 9 additions & 0 deletions Test/Unit/Model/Methods/SafeInvoiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
use Magento\Quote\Model\Quote\Address;
use Payone\Core\Model\Api\Request\Authorization;
use Magento\Payment\Model\Info;
use Magento\Sales\Model\Order\Payment;

class SafeInvoiceTest extends BaseTestCase
{
Expand Down Expand Up @@ -102,9 +103,13 @@ public function testAuthorizeRegistered()
$store = $this->getMockBuilder(Store::class)->disableOriginalConstructor()->getMock();
$store->method('getCode')->willReturn('test');

$payment = $this->getMockBuilder(Payment::class)->disableOriginalConstructor()->getMock();
$payment->method('getAdditionalInformation')->willReturn([]);

$order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
$order->method('getCustomerId')->willReturn('5');
$order->method('getStore')->willReturn($store);
$order->method('getPayment')->willReturn($payment);

$paymentInfo = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock();
$paymentInfo->method('getOrder')->willReturn($order);
Expand All @@ -121,9 +126,13 @@ public function testAuthorizeGuest()
$store = $this->getMockBuilder(Store::class)->disableOriginalConstructor()->getMock();
$store->method('getCode')->willReturn('test');

$payment = $this->getMockBuilder(Payment::class)->disableOriginalConstructor()->getMock();
$payment->method('getAdditionalInformation')->willReturn([]);

$order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();
$order->method('getCustomerId')->willReturn(null);
$order->method('getStore')->willReturn($store);
$order->method('getPayment')->willReturn($payment);

$paymentInfo = $this->getMockBuilder(Info::class)->disableOriginalConstructor()->setMethods(['getOrder'])->getMock();
$paymentInfo->method('getOrder')->willReturn($order);
Expand Down

0 comments on commit 503e34a

Please sign in to comment.