Skip to content

Commit 6335185

Browse files
author
Joan He
committed
MAGETWO-91545: 404 Error not found page ” issue in change status and update attribute from product grid
- Make isActionAllowed() public method
1 parent 2a38f92 commit 6335185

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

app/code/Magento/Catalog/Test/Unit/Ui/Component/Product/MassActionTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,36 @@ public function getPrepareDataProvider() : array
203203
],
204204
];
205205
}
206+
207+
/**
208+
* @param bool $expected
209+
* @param string $actionType
210+
* @param int $callNum
211+
* @param string $resource
212+
* @param bool $isAllowed
213+
* @dataProvider isActionAllowedDataProvider
214+
*/
215+
public function testIsActionAllowed($expected, $actionType, $callNum, $resource = '', $isAllowed = true )
216+
{
217+
$this->authorizationMock->expects($this->exactly($callNum))
218+
->method('isAllowed')
219+
->with($resource)
220+
->willReturn($isAllowed);
221+
222+
$this->assertEquals($expected, $this->massAction->isActionAllowed($actionType));
223+
}
224+
225+
public function isActionAllowedDataProvider()
226+
{
227+
return [
228+
'other' => [true, 'other', 0,],
229+
'delete-allowed' => [true, 'delete', 1, 'Magento_Catalog::products'],
230+
'delete-not-allowed' => [false, 'delete', 1, 'Magento_Catalog::products', false],
231+
'status-allowed' => [true, 'status', 1, 'Magento_Catalog::products'],
232+
'status-not-allowed' => [false, 'status', 1, 'Magento_Catalog::products', false],
233+
'attributes-allowed' => [true, 'attributes', 1, 'Magento_Catalog::update_attributes'],
234+
'attributes-not-allowed' => [false, 'attributes', 1, 'Magento_Catalog::update_attributes', false],
235+
236+
];
237+
}
206238
}

app/code/Magento/Catalog/Ui/Component/Product/MassAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function getComponentName() : string
8080
* @param string $actionType
8181
* @return bool
8282
*/
83-
private function isActionAllowed($actionType) : bool
83+
public function isActionAllowed($actionType) : bool
8484
{
8585
$isAllowed = true;
8686
switch ($actionType) {

0 commit comments

Comments
 (0)