@@ -203,4 +203,36 @@ public function getPrepareDataProvider() : array
203
203
],
204
204
];
205
205
}
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
+ }
206
238
}
0 commit comments