31 $this->closureMock =
function () {
34 $this->subjectMock = $this->createMock(\
Magento\Backend\
App\AbstractAction::class);
35 $this->requestMock = $this->getMockForAbstractClass(
36 RequestInterface::class,
42 [
'getPost',
'setPostValue']
47 \
Magento\Backend\
App\Action\Plugin\MassactionKey::class,
49 'subject' => $this->subjectMock,
50 'request' => $this->requestMock,
62 $this->requestMock->expects($this->at(0))
64 ->with(
'massaction_prepare_key')
65 ->will($this->returnValue(
'key'));
66 $this->requestMock->expects($this->at(1))
70 $this->requestMock->expects($this->once())
71 ->method(
'setPostValue')
72 ->with(
'key', $convertedData);
74 $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock);
83 'post_data_is_array' => [[
'key'], [
'key']],
84 'post_data_is_string' => [
'key, key_two', [
'key',
' key_two']]
90 $this->requestMock->expects($this->once())
92 ->with(
'massaction_prepare_key')
93 ->will($this->returnValue(
false));
94 $this->requestMock->expects($this->never())
95 ->method(
'setPostValue');
97 $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock);
beforeDispatchDataProvider()
testBeforeDispatchWhenMassactionPrepareKeyRequestNotExists()
testBeforeDispatchWhenMassactionPrepareKeyRequestExists($postData, $convertedData)