Skip to content

Commit 7aece94

Browse files
committed
Merge remote-tracking branch 'magento-tango/MC-21897' into MPI-PR-2019-10-18
2 parents 2aaba35 + 7a78b66 commit 7aece94

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

lib/internal/Magento/Framework/Mview/Test/Unit/ViewTest.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ protected function setUp()
5151
['getView']
5252
);
5353
$this->actionFactoryMock = $this->createPartialMock(\Magento\Framework\Mview\ActionFactory::class, ['get']);
54-
$this->stateMock = $this->createPartialMock(\Magento\Indexer\Model\Mview\View\State::class, ['getViewId',
54+
$this->stateMock = $this->createPartialMock(
55+
\Magento\Indexer\Model\Mview\View\State::class,
56+
[
57+
'getViewId',
5558
'loadByView',
5659
'getVersionId',
5760
'setVersionId',
@@ -62,7 +65,8 @@ protected function setUp()
6265
'setMode',
6366
'save',
6467
'__wakeup',
65-
]);
68+
]
69+
);
6670
$this->changelogMock = $this->createPartialMock(
6771
\Magento\Framework\Mview\View\Changelog::class,
6872
['getViewId', 'setViewId', 'create', 'drop', 'getVersion', 'getList', 'clear']
@@ -182,11 +186,11 @@ public function testSubscribeWithException()
182186

183187
$this->changelogMock->expects($this->once())
184188
->method('create')
185-
->will($this->returnCallback(
189+
->willReturnCallback(
186190
function () {
187191
throw new \Exception();
188192
}
189-
));
193+
);
190194

191195
$this->loadView();
192196
$this->model->subscribe();
@@ -245,11 +249,11 @@ public function testUnsubscribeWithException()
245249
$subscriptionMock = $this->createPartialMock(\Magento\Framework\Mview\View\Subscription::class, ['remove']);
246250
$subscriptionMock->expects($this->exactly(1))
247251
->method('remove')
248-
->will($this->returnCallback(
252+
->willReturnCallback(
249253
function () {
250254
throw new \Exception();
251255
}
252-
));
256+
);
253257
$this->subscriptionFactoryMock->expects($this->exactly(1))
254258
->method('create')
255259
->will($this->returnValue($subscriptionMock));
@@ -273,6 +277,9 @@ public function testUpdate()
273277
$this->stateMock->expects($this->once())
274278
->method('setVersionId')
275279
->will($this->returnSelf());
280+
$this->stateMock->expects($this->atLeastOnce())
281+
->method('getMode')
282+
->willReturn(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED);
276283
$this->stateMock->expects($this->exactly(2))
277284
->method('getStatus')
278285
->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::STATUS_IDLE));
@@ -335,6 +342,9 @@ public function testUpdateWithException()
335342
->will($this->returnValue($lastVersionId));
336343
$this->stateMock->expects($this->never())
337344
->method('setVersionId');
345+
$this->stateMock->expects($this->atLeastOnce())
346+
->method('getMode')
347+
->willReturn(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED);
338348
$this->stateMock->expects($this->exactly(2))
339349
->method('getStatus')
340350
->will($this->returnValue(\Magento\Framework\Mview\View\StateInterface::STATUS_IDLE));

lib/internal/Magento/Framework/Mview/View.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public function unsubscribe()
240240
*/
241241
public function update()
242242
{
243-
if ($this->getState()->getStatus() !== View\StateInterface::STATUS_IDLE) {
243+
if (!$this->isIdle() || !$this->isEnabled()) {
244244
return;
245245
}
246246

0 commit comments

Comments
 (0)