Skip to content

Commit

Permalink
[ECP-8855-v9] Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
candemiralp committed Mar 7, 2024
1 parent 611a9b3 commit cf71386
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Test/Unit/Helper/WebhookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,7 +18,6 @@
use Adyen\Payment\Helper\Webhook\WebhookHandlerFactory;
use Adyen\Payment\Logger\AdyenLogger;
use ReflectionMethod;
use ReflectionClass;

class WebhookTest extends AbstractAdyenTestCase
{
Expand Down Expand Up @@ -190,6 +188,7 @@ public function testUpdateAdyenAttributes()
$orderMock = $this->getMockBuilder(Order::class)
->disableOriginalConstructor()
->getMock();
$orderMock->method('getData')->willReturnSelf();

$paymentMock = $this->getMockBuilder(Payment::class)
->disableOriginalConstructor()
Expand All @@ -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())
Expand Down

0 comments on commit cf71386

Please sign in to comment.