Skip to content

Commit e76ca5a

Browse files
committed
Merge remote-tracking branch 'local/ACP2E-1405' into PR_25_NOV_2022
2 parents 94c1e24 + 4398f07 commit e76ca5a

File tree

2 files changed

+17
-13
lines changed
  • app/code/Magento/AsynchronousOperations

2 files changed

+17
-13
lines changed

app/code/Magento/AsynchronousOperations/Controller/Adminhtml/Notification/Dismiss.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
use Magento\AsynchronousOperations\Model\BulkNotificationManagement;
99
use Magento\Backend\App\Action\Context;
1010
use Magento\Backend\App\Action;
11-
use Magento\Framework\App\Action\HttpGetActionInterface;
11+
use Magento\Framework\App\Action\HttpPostActionInterface;
1212
use Magento\Framework\Controller\ResultFactory;
1313

1414
/**
1515
* Class Bulk Notification Dismiss Controller
1616
*/
17-
class Dismiss extends Action implements HttpGetActionInterface
17+
class Dismiss extends Action implements HttpPostActionInterface
1818
{
1919
/**
2020
* @var BulkNotificationManagement
@@ -56,7 +56,7 @@ public function execute()
5656
$isAcknowledged = $this->notificationManagement->acknowledgeBulks($bulkUuids);
5757

5858
/** @var \Magento\Framework\Controller\Result\Json $result */
59-
$result = $this->resultFactory->create(ResultFactory::TYPE_RAW);
59+
$result = $this->resultFactory->create(ResultFactory::TYPE_JSON)->setData(['']);
6060
if (!$isAcknowledged) {
6161
$result->setHttpResponseCode(400);
6262
}

app/code/Magento/AsynchronousOperations/Test/Unit/Controller/Adminhtml/Notification/DismissTest.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Magento\AsynchronousOperations\Model\BulkNotificationManagement;
1212
use Magento\Framework\App\RequestInterface;
1313
use Magento\Framework\Controller\Result\Json;
14-
use Magento\Framework\Controller\Result\Raw;
1514
use Magento\Framework\Controller\ResultFactory;
1615
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1716
use PHPUnit\Framework\MockObject\MockObject;
@@ -44,11 +43,6 @@ class DismissTest extends TestCase
4443
*/
4544
private $jsonResultMock;
4645

47-
/**
48-
* @var MockObject
49-
*/
50-
private $rawResultMock;
51-
5246
protected function setUp(): void
5347
{
5448
$objectManager = new ObjectManager($this);
@@ -84,10 +78,15 @@ public function testExecute()
8478

8579
$this->resultFactoryMock->expects($this->once())
8680
->method('create')
87-
->with(ResultFactory::TYPE_RAW, [])
88-
->willReturn($this->rawResultMock);
81+
->with(ResultFactory::TYPE_JSON, [])
82+
->willReturn($this->jsonResultMock);
83+
84+
$this->jsonResultMock->expects($this->once())
85+
->method('setData')
86+
->with([''])
87+
->willReturn($this->jsonResultMock);
8988

90-
$this->assertEquals($this->rawResultMock, $this->model->execute());
89+
$this->assertEquals($this->jsonResultMock, $this->model->execute());
9190
}
9291

9392
public function testExecuteSetsBadRequestResponseStatusIfBulkWasNotAcknowledgedCorrectly()
@@ -101,7 +100,12 @@ public function testExecuteSetsBadRequestResponseStatusIfBulkWasNotAcknowledgedC
101100

102101
$this->resultFactoryMock->expects($this->once())
103102
->method('create')
104-
->with(ResultFactory::TYPE_RAW, [])
103+
->with(ResultFactory::TYPE_JSON, [])
104+
->willReturn($this->jsonResultMock);
105+
106+
$this->jsonResultMock->expects($this->once())
107+
->method('setData')
108+
->with([''])
105109
->willReturn($this->jsonResultMock);
106110

107111
$this->notificationManagementMock->expects($this->once())

0 commit comments

Comments
 (0)