File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed
app/code/Magento/Customer Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -139,9 +139,11 @@ protected function _prepareLayout()
139
139
140
140
if ($ postedData = $ this ->_customerSession ->getAddressFormData (true )) {
141
141
$ postedData ['region ' ] = [
142
- 'region_id ' => $ postedData ['region_id ' ] ?? null ,
143
142
'region ' => $ postedData ['region ' ] ?? null ,
144
143
];
144
+ if (!empty ($ postedData ['region_id ' ])) {
145
+ $ postedData ['region ' ]['region_id ' ] = $ postedData ['region_id ' ];
146
+ }
145
147
$ this ->dataObjectHelper ->populateWithArray (
146
148
$ this ->_address ,
147
149
$ postedData ,
Original file line number Diff line number Diff line change @@ -101,15 +101,15 @@ protected function setUp()
101
101
);
102
102
}
103
103
104
- public function testSetLayoutWithOwnAddressAndPostedData ()
104
+ /**
105
+ * @param array $postedData
106
+ * @dataProvider postedDataProvider
107
+ */
108
+ public function testSetLayoutWithOwnAddressAndPostedData (array $ postedData )
105
109
{
106
110
$ addressId = 1 ;
107
111
$ customerId = 1 ;
108
112
$ title = __ ('Edit Address ' );
109
- $ postedData = [
110
- 'region_id ' => 1 ,
111
- 'region ' => 'region ' ,
112
- ];
113
113
$ newPostedData = $ postedData ;
114
114
$ newPostedData ['region ' ] = $ postedData ;
115
115
@@ -169,6 +169,21 @@ public function testSetLayoutWithOwnAddressAndPostedData()
169
169
$ this ->assertEquals ($ layoutMock , $ this ->model ->getLayout ());
170
170
}
171
171
172
+ /**
173
+ * @return array
174
+ */
175
+ public function postedDataProvider ()
176
+ {
177
+ return [
178
+ [
179
+ ['region_id ' => 1 , 'region ' => 'region ' ]
180
+ ],
181
+ [
182
+ ['region ' => 'region without id ' ]
183
+ ]
184
+ ];
185
+ }
186
+
172
187
/**
173
188
* @throws \Magento\Framework\Exception\LocalizedException
174
189
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
You can’t perform that action at this time.
0 commit comments