From cf71386e88ba4919a2dc597d7ec033bd867dd762 Mon Sep 17 00:00:00 2001 From: Can Demiralp Date: Thu, 7 Mar 2024 13:38:22 +0100 Subject: [PATCH] [ECP-8855-v9] Update unit tests --- Test/Unit/Helper/WebhookTest.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Test/Unit/Helper/WebhookTest.php b/Test/Unit/Helper/WebhookTest.php index 3d818df85..b94d27f3a 100644 --- a/Test/Unit/Helper/WebhookTest.php +++ b/Test/Unit/Helper/WebhookTest.php @@ -2,7 +2,6 @@ namespace Adyen\Payment\Test\Unit\Helper; use Adyen\Payment\Helper\Webhook; -use Adyen\Payment\Helper\Webhook\AuthorisationWebhookHandler; use Adyen\Payment\Helper\Webhook\WebhookHandlerInterface; use Adyen\Payment\Model\Notification; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; @@ -19,7 +18,6 @@ use Adyen\Payment\Helper\Webhook\WebhookHandlerFactory; use Adyen\Payment\Logger\AdyenLogger; use ReflectionMethod; -use ReflectionClass; class WebhookTest extends AbstractAdyenTestCase { @@ -190,6 +188,7 @@ public function testUpdateAdyenAttributes() $orderMock = $this->getMockBuilder(Order::class) ->disableOriginalConstructor() ->getMock(); + $orderMock->method('getData')->willReturnSelf(); $paymentMock = $this->getMockBuilder(Payment::class) ->disableOriginalConstructor() @@ -203,8 +202,21 @@ public function testUpdateAdyenAttributes() ->disableOriginalConstructor() ->getMock(); + $orderRepositoryMock = $this->createMock(OrderRepository::class); + $orderRepositoryMock->method('get')->willReturn($orderMock); + // Create an instance of your class - $webhook = $this->createWebhook(null, $serializerMock, null, null, null, $loggerMock, null, null, null); + $webhook = $this->createWebhook( + null, + $serializerMock, + null, + null, + null, + $loggerMock, + null, + null, + $orderRepositoryMock + ); // Set up expectations for the mocked objects $notificationMock->expects($this->once())