File tree Expand file tree Collapse file tree 3 files changed +26
-9
lines changed
Backend/Test/Unit/Model/Session
Sales/Block/Adminhtml/Order/Create/Form
dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form Expand file tree Collapse file tree 3 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -267,7 +267,10 @@ public function testGetQuoteWithoutQuoteId()
267
267
$ cartInterfaceMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ($ quoteId );
268
268
$ defaultGroup = $ this ->getMockBuilder (\Magento \Customer \Api \Data \GroupInterface::class)->getMock ();
269
269
$ defaultGroup ->expects ($ this ->any ())->method ('getId ' )->will ($ this ->returnValue ($ customerGroupId ));
270
- $ this ->groupManagementMock ->expects ($ this ->any ())->method ('getDefaultGroup ' )->willReturn ($ defaultGroup );
270
+ $ this ->groupManagementMock
271
+ ->method ('getDefaultGroup ' )
272
+ ->with ($ storeId )
273
+ ->willReturn ($ defaultGroup );
271
274
272
275
$ dataCustomerMock = $ this ->getMockBuilder (\Magento \Customer \Api \Data \CustomerInterface::class)
273
276
->disableOriginalConstructor ()
Original file line number Diff line number Diff line change @@ -132,13 +132,8 @@ protected function _prepareForm()
132
132
$ this ->_addAttributesToForm ($ attributes , $ fieldset );
133
133
134
134
$ this ->_form ->addFieldNameSuffix ('order[account] ' );
135
- $ formValues = $ this ->getFormValues ();
136
- foreach ($ attributes as $ code => $ attribute ) {
137
- $ defaultValue = $ attribute ->getDefaultValue ();
138
- if (isset ($ defaultValue ) && !isset ($ formValues [$ code ])) {
139
- $ formValues [$ code ] = $ defaultValue ;
140
- }
141
- }
135
+
136
+ $ formValues = $ this ->extractValuesFromAttributes ($ attributes );
142
137
$ this ->_form ->setValues ($ formValues );
143
138
144
139
return $ this ;
@@ -192,4 +187,23 @@ public function getFormValues()
192
187
193
188
return $ data ;
194
189
}
190
+
191
+ /**
192
+ * Extract the form values from attributes.
193
+ *
194
+ * @param array $attributes
195
+ * @return array
196
+ */
197
+ private function extractValuesFromAttributes (array $ attributes ): array
198
+ {
199
+ $ formValues = $ this ->getFormValues ();
200
+ foreach ($ attributes as $ code => $ attribute ) {
201
+ $ defaultValue = $ attribute ->getDefaultValue ();
202
+ if (isset ($ defaultValue ) && !isset ($ formValues [$ code ])) {
203
+ $ formValues [$ code ] = $ defaultValue ;
204
+ }
205
+ }
206
+
207
+ return $ formValues ;
208
+ }
195
209
}
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ class AccountTest extends \PHPUnit\Framework\TestCase
45
45
private $ session ;
46
46
47
47
/**
48
- * { @inheritdoc}
48
+ * @inheritdoc
49
49
*/
50
50
protected function setUp ()
51
51
{
You can’t perform that action at this time.
0 commit comments