Skip to content

Commit e5be53f

Browse files
remove filtering by unique value
1 parent daecbb4 commit e5be53f

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

app/code/Magento/Customer/Model/Options.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,11 @@ private function prepareNamePrefixSuffixOptions($options, $isOptional = false)
101101
$result = [];
102102
$options = explode(';', $options);
103103
foreach ($options as $value) {
104-
$value = $this->escaper->escapeHtml(trim($value)) ?: ' ';
105-
$result[$value] = $value;
104+
$result[] = $this->escaper->escapeHtml(trim($value)) ?: ' ';
106105
}
107106

108107
if ($isOptional && trim(current($options))) {
109-
$result = array_merge([' ' => ' '], $result);
108+
$result = array_merge([' '], $result);
110109
}
111110

112111
return $result;

dev/tests/integration/testsuite/Magento/Customer/Model/OptionsTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ public function optionsDataProvider(): array
102102
$optionPrefixName = 'prefix';
103103
$optionSuffixName = 'suffix';
104104
$optionValues = 'v1;v2';
105+
$expectedValues = ['v1', 'v2'];
105106
$optionValuesWithBlank = ';v1;v2';
106-
$expectedValuesWithBlank = [' ' => ' ', 'v1' => 'v1', 'v2' => 'v2'];
107-
$expectedValues = ['v1' => 'v1', 'v2' => 'v2'];
107+
$expectedValuesWithBlank = [' ', 'v1', 'v2'];
108+
$optionValuesWithTwoBlank = ';v1;v2;';
109+
$expectedValuesTwoBlank = [' ', 'v1', 'v2', ' '];
108110

109111
return [
110112
'prefix_required_with_blank_option' => [
@@ -119,6 +121,12 @@ public function optionsDataProvider(): array
119121
[self::XML_PATH_PREFIX_OPTIONS => $optionValues],
120122
$expectedValues,
121123
],
124+
'prefix_required_with_two_blank_option' => [
125+
$optionPrefixName,
126+
[self::XML_PATH_PREFIX_SHOW => Nooptreq::VALUE_REQUIRED],
127+
[self::XML_PATH_PREFIX_OPTIONS => $optionValuesWithTwoBlank],
128+
$expectedValuesTwoBlank,
129+
],
122130
'prefix_optional' => [
123131
$optionPrefixName,
124132
[self::XML_PATH_PREFIX_SHOW => Nooptreq::VALUE_OPTIONAL],

0 commit comments

Comments
 (0)