From 503e34a5ccab20bb2e2d25ac477ff056542906a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Thu, 14 Dec 2023 17:15:26 +0100 Subject: [PATCH] MAG2-302 - Fixed unit-tests --- Test/Unit/Model/Methods/AmazonPayTest.php | 5 +++++ Test/Unit/Model/Methods/BarzahlenTest.php | 5 +++++ Test/Unit/Model/Methods/SafeInvoiceTest.php | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/Test/Unit/Model/Methods/AmazonPayTest.php b/Test/Unit/Model/Methods/AmazonPayTest.php index 99a35d11..2926737e 100644 --- a/Test/Unit/Model/Methods/AmazonPayTest.php +++ b/Test/Unit/Model/Methods/AmazonPayTest.php @@ -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 { @@ -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); diff --git a/Test/Unit/Model/Methods/BarzahlenTest.php b/Test/Unit/Model/Methods/BarzahlenTest.php index e0d79626..f5f2cc25 100644 --- a/Test/Unit/Model/Methods/BarzahlenTest.php +++ b/Test/Unit/Model/Methods/BarzahlenTest.php @@ -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 { @@ -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); diff --git a/Test/Unit/Model/Methods/SafeInvoiceTest.php b/Test/Unit/Model/Methods/SafeInvoiceTest.php index fb2e331e..24bfb584 100644 --- a/Test/Unit/Model/Methods/SafeInvoiceTest.php +++ b/Test/Unit/Model/Methods/SafeInvoiceTest.php @@ -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 { @@ -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); @@ -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);