File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed
Controller/Adminhtml/Product/Attribute
Test/Unit/Controller/Adminhtml/Product/Attribute Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,11 @@ public function execute()
113
113
$ options
114
114
);
115
115
$ valueOptions = (isset ($ options ['value ' ]) && is_array ($ options ['value ' ])) ? $ options ['value ' ] : [];
116
+ foreach (array_keys ($ valueOptions ) as $ key ) {
117
+ if (!empty ($ options ['delete ' ][$ key ])) {
118
+ unset($ valueOptions [$ key ]);
119
+ }
120
+ }
116
121
$ this ->checkEmptyOption ($ response , $ valueOptions );
117
122
}
118
123
Original file line number Diff line number Diff line change @@ -249,6 +249,20 @@ public function provideUniqueData()
249
249
]
250
250
], false
251
251
],
252
+ 'empty and deleted ' => [
253
+ [
254
+ 'value ' => [
255
+ "option_0 " => [1 , 0 ],
256
+ "option_1 " => [2 , 0 ],
257
+ "option_2 " => ["" , "" ],
258
+ ],
259
+ 'delete ' => [
260
+ "option_0 " => "" ,
261
+ "option_1 " => "" ,
262
+ "option_2 " => "1 " ,
263
+ ]
264
+ ], false
265
+ ],
252
266
];
253
267
}
254
268
@@ -321,7 +335,34 @@ public function provideEmptyOption()
321
335
(object ) [
322
336
'error ' => false ,
323
337
]
324
- ]
338
+ ],
339
+ 'empty admin scope options and deleted ' => [
340
+ [
341
+ 'value ' => [
342
+ "option_0 " => ['' ],
343
+ ],
344
+ 'delete ' => [
345
+ 'option_0 ' => '1 ' ,
346
+ ],
347
+ ],
348
+ (object ) [
349
+ 'error ' => false ,
350
+ ],
351
+ ],
352
+ 'empty admin scope options and not deleted ' => [
353
+ [
354
+ 'value ' => [
355
+ "option_0 " => ['' ],
356
+ ],
357
+ 'delete ' => [
358
+ 'option_0 ' => '0 ' ,
359
+ ],
360
+ ],
361
+ (object ) [
362
+ 'error ' => true ,
363
+ 'message ' => 'The value of Admin scope can \'t be empty. ' ,
364
+ ],
365
+ ],
325
366
];
326
367
}
327
368
}
You can’t perform that action at this time.
0 commit comments