Skip to content

Commit f96f890

Browse files
committed
MC-13613 Product mass update
1 parent 62abb3c commit f96f890

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

lib/internal/Magento/Framework/MessageQueue/Test/Unit/ConsumerTest.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
namespace Magento\Framework\MessageQueue\Test\Unit;
88

9+
use Magento\Framework\MessageQueue\PoisonPill\PoisonPillCompareInterface;
10+
use Magento\Framework\MessageQueue\PoisonPill\PoisonPillReadInterface;
911
use Magento\Framework\Phrase;
1012

1113
/**
@@ -65,6 +67,16 @@ class ConsumerTest extends \PHPUnit\Framework\TestCase
6567
*/
6668
private $consumer;
6769

70+
/**
71+
* @var PoisonPillReadInterface|\PHPUnit_Framework_MockObject_MockObject
72+
*/
73+
private $poisonPillRead;
74+
75+
/**
76+
* @var PoisonPillCompareInterface|\PHPUnit_Framework_MockObject_MockObject
77+
*/
78+
private $poisonPillCompare;
79+
6880
/**
6981
* Set up.
7082
*
@@ -85,8 +97,15 @@ protected function setUp()
8597
->disableOriginalConstructor()->getMock();
8698

8799
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
100+
$this->poisonPillCompare = $this->getMockBuilder(PoisonPillCompareInterface::class)
101+
->disableOriginalConstructor()->getMock();
102+
$this->poisonPillRead = $this->getMockBuilder(PoisonPillReadInterface::class)
103+
->disableOriginalConstructor()->getMock();
88104
//Hard dependency used because CallbackInvoker invokes closure logic defined inside of Customer class.
89-
$this->callbackInvoker = new \Magento\Framework\MessageQueue\CallbackInvoker();
105+
$this->callbackInvoker = new \Magento\Framework\MessageQueue\CallbackInvoker(
106+
$this->poisonPillRead,
107+
$this->poisonPillCompare
108+
);
90109
$this->consumer = $objectManager->getObject(
91110
\Magento\Framework\MessageQueue\Consumer::class,
92111
[
@@ -134,7 +153,8 @@ public function testProcessWithNotFoundException()
134153
$numberOfMessages = 1;
135154
$consumerName = 'consumer.name';
136155
$exceptionPhrase = new Phrase('Exception successfully thrown');
137-
156+
$this->poisonPillRead->expects($this->atLeastOnce())->method('getLatestVersion')->willReturn('version-1');
157+
$this->poisonPillCompare->expects($this->atLeastOnce())->method('isLatestVersion')->willReturn(true);
138158
$queue = $this->getMockBuilder(\Magento\Framework\MessageQueue\QueueInterface::class)
139159
->disableOriginalConstructor()->getMock();
140160
$this->configuration->expects($this->once())->method('getQueue')->willReturn($queue);

0 commit comments

Comments
 (0)