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 @@ -110,6 +110,11 @@ public function execute()
110110 $ options
111111 );
112112 $ valueOptions = (isset ($ options ['value ' ]) && is_array ($ options ['value ' ])) ? $ options ['value ' ] : [];
113+ foreach (array_keys ($ valueOptions ) as $ key ) {
114+ if (!empty ($ options ['delete ' ][$ key ])) {
115+ unset($ valueOptions [$ key ]);
116+ }
117+ }
113118 $ this ->checkEmptyOption ($ response , $ valueOptions );
114119 }
115120
Original file line number Diff line number Diff line change @@ -249,6 +249,20 @@ public function provideUniqueData()
249249 ]
250250 ], false
251251 ],
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+ ],
252266 ];
253267 }
254268
@@ -321,7 +335,34 @@ public function provideEmptyOption()
321335 (object ) [
322336 'error ' => false ,
323337 ]
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+ ],
325366 ];
326367 }
327368}
You can’t perform that action at this time.
0 commit comments