Skip to content

Commit 0dcf012

Browse files
committed
MAGETWO-86295: 404 Error not found page ” issue in change status and update attribute from product grid
1 parent 3cac39c commit 0dcf012

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1313
use Magento\Framework\View\Element\UiComponent\ContextInterface;
1414

15+
/**
16+
* Test for Magento\Catalog\Ui\Component\Product\MassAction class.
17+
*/
1518
class MassActionTest extends \PHPUnit\Framework\TestCase
1619
{
1720
/**
@@ -34,6 +37,9 @@ class MassActionTest extends \PHPUnit\Framework\TestCase
3437
*/
3538
private $massAction;
3639

40+
/**
41+
* @inheritdoc
42+
*/
3743
protected function setUp()
3844
{
3945
$this->objectManager = new ObjectManager($this);
@@ -48,11 +54,14 @@ protected function setUp()
4854
[
4955
'authorization' => $this->authorizationMock,
5056
'context' => $this->contextMock,
51-
'data' => []
57+
'data' => [],
5258
]
5359
);
5460
}
5561

62+
/**
63+
* @return void
64+
*/
5665
public function testGetComponentName()
5766
{
5867
$this->assertTrue($this->massAction->getComponentName() === MassAction::NAME);
@@ -214,6 +223,7 @@ public function getPrepareDataProvider() : array
214223
* @param int $callNum
215224
* @param string $resource
216225
* @param bool $isAllowed
226+
* @return void
217227
* @dataProvider isActionAllowedDataProvider
218228
*/
219229
public function testIsActionAllowed(
@@ -231,7 +241,10 @@ public function testIsActionAllowed(
231241
$this->assertEquals($expected, $this->massAction->isActionAllowed($actionType));
232242
}
233243

234-
public function isActionAllowedDataProvider()
244+
/**
245+
* @return array
246+
*/
247+
public function isActionAllowedDataProvider(): array
235248
{
236249
return [
237250
'other' => [true, 'other', 0,],
@@ -241,7 +254,6 @@ public function isActionAllowedDataProvider()
241254
'status-not-allowed' => [false, 'status', 1, 'Magento_Catalog::products', false],
242255
'attributes-allowed' => [true, 'attributes', 1, 'Magento_Catalog::update_attributes'],
243256
'attributes-not-allowed' => [false, 'attributes', 1, 'Magento_Catalog::update_attributes', false],
244-
245257
];
246258
}
247259
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use Magento\Framework\View\Element\UiComponent\ContextInterface;
1313
use Magento\Ui\Component\AbstractComponent;
1414

15+
/**
16+
* Provide validation of allowed massaction for user.
17+
*/
1518
class MassAction extends AbstractComponent
1619
{
1720
const NAME = 'massaction';
@@ -38,7 +41,7 @@ public function __construct(
3841
}
3942

4043
/**
41-
* {@inheritdoc}
44+
* @inheritdoc
4245
*/
4346
public function prepare()
4447
{
@@ -62,7 +65,7 @@ public function prepare()
6265
}
6366

6467
/**
65-
* {@inheritdoc}
68+
* @inheritdoc
6669
*/
6770
public function getComponentName(): string
6871
{
@@ -80,8 +83,6 @@ public function isActionAllowed(string $actionType): bool
8083
$isAllowed = true;
8184
switch ($actionType) {
8285
case 'delete':
83-
$isAllowed = $this->authorization->isAllowed('Magento_Catalog::products');
84-
break;
8586
case 'status':
8687
$isAllowed = $this->authorization->isAllowed('Magento_Catalog::products');
8788
break;

0 commit comments

Comments
 (0)