-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
162 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,10 @@ DB_NAME=magento \ | |
DB_USER=magento \ | ||
DB_PASSWORD=magento \ | ||
DB_PREFIX=m2_ \ | ||
ELASTICSEARCH_SERVER="<will be defined>" \ | ||
ELASTICSEARCH_PORT=9200 \ | ||
ELASTICSEARCH_INDEX_PREFIX=magento2 \ | ||
ELASTICSEARCH_TIMEOUT=15 \ | ||
OPENSEARCH_SERVER="<will be defined>" \ | ||
OPENSEARCH_PORT=9200 \ | ||
OPENSEARCH_INDEX_PREFIX=magento2 \ | ||
OPENSEARCH_TIMEOUT=15 \ | ||
ADMIN_NAME=admin \ | ||
ADMIN_LASTNAME=admin \ | ||
[email protected] \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
namespace Adyen\Payment\Test\Unit\Model\Queue\Notification; | ||
|
||
use Adyen\Payment\Helper\Webhook; | ||
use Adyen\Payment\Logger\AdyenLogger; | ||
use Adyen\Payment\Model\Notification; | ||
use Adyen\Payment\Model\Queue\Notification\Consumer; | ||
use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; | ||
use Exception; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
|
||
class ConsumerTest extends AbstractAdyenTestCase | ||
{ | ||
/** @var Webhook|MockObject $webhookMock */ | ||
private $webhookMock; | ||
|
||
/** @var AdyenLogger|MockObject $adyenLoggerMock */ | ||
private $adyenLoggerMock; | ||
|
||
/** @var Notification|MockObject $notificationMock */ | ||
private $notificationMock; | ||
|
||
/** @var Consumer $consumer */ | ||
private $consumer; | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function setUp(): void | ||
{ | ||
$this->webhookMock = $this->createMock(Webhook::class); | ||
$this->adyenLoggerMock = $this->createMock(AdyenLogger::class); | ||
$this->notificationMock = $this->createMock(Notification::class); | ||
$this->consumer = new Consumer($this->webhookMock, $this->adyenLoggerMock); | ||
} | ||
|
||
/** | ||
* @return void | ||
* @throws Exception | ||
*/ | ||
public function testExecute(): void | ||
{ | ||
$this->webhookMock->expects($this->once()) | ||
->method('processNotification') | ||
->with($this->notificationMock) | ||
->willReturn(true); | ||
|
||
$this->assertTrue($this->consumer->execute($this->notificationMock)); | ||
} | ||
|
||
/** | ||
* @return void | ||
* @throws Exception | ||
*/ | ||
public function testExecuteThrowsException(): void | ||
{ | ||
$this->webhookMock->expects($this->once()) | ||
->method('processNotification') | ||
->with($this->notificationMock) | ||
->willThrowException(new Exception()); | ||
$this->adyenLoggerMock->expects($this->once())->method('addAdyenWarning'); | ||
|
||
$this->expectException(Exception::class); | ||
$this->consumer->execute($this->notificationMock); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Adyen\Payment\Test\Unit\Model\Queue\Notification; | ||
|
||
use Adyen\Payment\Model\Notification; | ||
use Adyen\Payment\Model\Queue\Notification\Publisher; | ||
use Adyen\Payment\Model\ResourceModel\Notification as NotificationResourceModel; | ||
use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; | ||
use Exception; | ||
use Magento\Framework\MessageQueue\PublisherInterface; | ||
|
||
class PublisherTest extends AbstractAdyenTestCase | ||
{ | ||
/** | ||
* @return void | ||
* @throws Exception | ||
*/ | ||
public function testExecute(): void | ||
{ | ||
$publisherMock = $this->createMock(PublisherInterface::class); | ||
$notificationResourceMock = $this->createMock(NotificationResourceModel::class); | ||
$notificationMock = $this->createMock(Notification::class); | ||
|
||
$notificationMock->expects($this->once())->method('setProcessing')->with(true); | ||
$notificationResourceMock->expects($this->once())->method('save')->with($notificationMock); | ||
$publisherMock->expects($this->once())->method('publish')->with(Publisher::TOPIC_NAME, $notificationMock); | ||
|
||
$publisher = new Publisher($publisherMock, $notificationResourceMock); | ||
$publisher->execute($notificationMock); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.