File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
app/code/Magento/AsynchronousOperations
Controller/Adminhtml/Notification
Test/Unit/Controller/Adminhtml/Notification Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 8
8
use Magento \AsynchronousOperations \Model \BulkNotificationManagement ;
9
9
use Magento \Backend \App \Action \Context ;
10
10
use Magento \Backend \App \Action ;
11
+ use Magento \Framework \App \Action \HttpPostActionInterface ;
11
12
use Magento \Framework \Controller \ResultFactory ;
12
13
13
14
/**
14
15
* Class Bulk Notification Dismiss Controller
15
16
*/
16
- class Dismiss extends Action
17
+ class Dismiss extends Action implements HttpPostActionInterface
17
18
{
18
19
/**
19
20
* @var BulkNotificationManagement
@@ -43,7 +44,7 @@ protected function _isAllowed()
43
44
}
44
45
45
46
/**
46
- * { @inheritdoc}
47
+ * @inheritdoc
47
48
*/
48
49
public function execute ()
49
50
{
@@ -55,7 +56,7 @@ public function execute()
55
56
$ isAcknowledged = $ this ->notificationManagement ->acknowledgeBulks ($ bulkUuids );
56
57
57
58
/** @var \Magento\Framework\Controller\Result\Json $result */
58
- $ result = $ this ->resultFactory ->create (ResultFactory::TYPE_JSON );
59
+ $ result = $ this ->resultFactory ->create (ResultFactory::TYPE_JSON )-> setData ([ '' ]) ;
59
60
if (!$ isAcknowledged ) {
60
61
$ result ->setHttpResponseCode (400 );
61
62
}
Original file line number Diff line number Diff line change @@ -81,6 +81,11 @@ public function testExecute()
81
81
->with (ResultFactory::TYPE_JSON , [])
82
82
->willReturn ($ this ->jsonResultMock );
83
83
84
+ $ this ->jsonResultMock ->expects ($ this ->once ())
85
+ ->method ('setData ' )
86
+ ->with (['' ])
87
+ ->willReturn ($ this ->jsonResultMock );
88
+
84
89
$ this ->assertEquals ($ this ->jsonResultMock , $ this ->model ->execute ());
85
90
}
86
91
@@ -98,6 +103,11 @@ public function testExecuteSetsBadRequestResponseStatusIfBulkWasNotAcknowledgedC
98
103
->with (ResultFactory::TYPE_RAW , [])
99
104
->willReturn ($ this ->jsonResultMock );
100
105
106
+ $ this ->jsonResultMock ->expects ($ this ->once ())
107
+ ->method ('setData ' )
108
+ ->with (['' ])
109
+ ->willReturn ($ this ->jsonResultMock );
110
+
101
111
$ this ->notificationManagementMock ->expects ($ this ->once ())
102
112
->method ('acknowledgeBulks ' )
103
113
->with ($ bulkUuids )
You can’t perform that action at this time.
0 commit comments