Skip to content

Commit 8becfa3

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-63736' into troll_bugfix_kanban
2 parents a9f1814 + 746749b commit 8becfa3

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ private function setMessageToResponse($response, $messages)
155155
private function checkUniqueOption(DataObject $response, array $options = null)
156156
{
157157
if (is_array($options)
158-
&& isset($options['value'])
159-
&& isset($options['delete'])
158+
&& !empty($options['value'])
159+
&& !empty($options['delete'])
160160
&& !$this->isUniqueAdminValues($options['value'], $options['delete'])
161161
) {
162162
$this->setMessageToResponse($response, [__("The value of Admin must be unique.")]);

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Attribute/ValidateTest.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,16 @@ public function testUniqueValidation(array $options, $isError)
198198
public function provideUniqueData()
199199
{
200200
return [
201-
// valid options
202-
[
201+
'no values' => [
202+
[
203+
'delete' => [
204+
"option_0" => "",
205+
"option_1" => "",
206+
"option_2" => "",
207+
]
208+
], false
209+
],
210+
'valid options' => [
203211
[
204212
'value' => [
205213
"option_0" => [1, 0],
@@ -213,8 +221,7 @@ public function provideUniqueData()
213221
]
214222
], false
215223
],
216-
//with duplicate
217-
[
224+
'duplicate options' => [
218225
[
219226
'value' => [
220227
"option_0" => [1, 0],
@@ -228,8 +235,7 @@ public function provideUniqueData()
228235
]
229236
], true
230237
],
231-
//with duplicate but deleted
232-
[
238+
'duplicate and deleted' => [
233239
[
234240
'value' => [
235241
"option_0" => [1, 0],

0 commit comments

Comments
 (0)