Skip to content

Commit 129529b

Browse files
author
Anna Bukatar
committed
ACP2E-1969: Incorrect behavior for system messages when trying to delete bulk product using REST API
1 parent f492741 commit 129529b

File tree

2 files changed

+6
-5
lines changed
  • app/code/Magento/AsynchronousOperations
    • Model/ResourceModel/System/Message/Collection/Synchronized
    • Test/Unit/Model/ResourceModel/System/Message/Collection/Synchronized

2 files changed

+6
-5
lines changed

app/code/Magento/AsynchronousOperations/Model/ResourceModel/System/Message/Collection/Synchronized/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
class Plugin
1212
{
13-
public const MESSAGES_LIMIT = 5;
13+
private const MESSAGES_LIMIT = 5;
1414
/**
1515
* @var \Magento\AdminNotification\Model\System\MessageFactory
1616
*/

app/code/Magento/AsynchronousOperations/Test/Unit/Model/ResourceModel/System/Message/Collection/Synchronized/PluginTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828
class PluginTest extends TestCase
2929
{
30+
private const MESSAGES_LIMIT = 5;
3031
/**
3132
* @var Plugin
3233
*/
@@ -171,7 +172,7 @@ public function testAfterTo($operationDetails)
171172
public function testAfterToWithMessageLimit()
172173
{
173174
$result = ['items' =>[], 'totalRecords' => 1];
174-
$messagesCount = Plugin::MESSAGES_LIMIT + 1;
175+
$messagesCount = self::MESSAGES_LIMIT + 1;
175176
$userId = 1;
176177
$bulkUuid = 2;
177178
$bulkArray = [
@@ -187,14 +188,14 @@ public function testAfterToWithMessageLimit()
187188
$bulkMock->expects($this->exactly($messagesCount))
188189
->method('getBulkId')->willReturn($bulkUuid);
189190
$this->operationsDetailsMock
190-
->expects($this->exactly(Plugin::MESSAGES_LIMIT))
191+
->expects($this->exactly(self::MESSAGES_LIMIT))
191192
->method('getDetails')
192193
->with($bulkUuid)
193194
->willReturn([
194195
'operations_successful' => 1,
195196
'operations_failed' => 0
196197
]);
197-
$bulkMock->expects($this->exactly(Plugin::MESSAGES_LIMIT))
198+
$bulkMock->expects($this->exactly(self::MESSAGES_LIMIT))
198199
->method('getDescription')->willReturn('Bulk Description');
199200
$this->messagefactoryMock->expects($this->exactly($messagesCount))
200201
->method('create')->willReturn($this->messageMock);
@@ -210,7 +211,7 @@ public function testAfterToWithMessageLimit()
210211
->method('getAcknowledgedBulksByUser')
211212
->with($userId)
212213
->willReturn([]);
213-
$this->statusMapper->expects($this->exactly(Plugin::MESSAGES_LIMIT))
214+
$this->statusMapper->expects($this->exactly(self::MESSAGES_LIMIT))
214215
->method('operationStatusToBulkSummaryStatus');
215216
$this->bulkStatusMock->expects($this->once())->method('getBulksByUser')->willReturn($userBulks);
216217
$result2 = $this->plugin->afterToArray($this->collectionMock, $result);

0 commit comments

Comments
 (0)