Skip to content

Commit 58e282a

Browse files
MAGETWO-98087: [2.3] Customer Group Regression issues from MAGETWO-96886
1 parent 7001229 commit 58e282a

File tree

3 files changed

+26
-9
lines changed
  • app/code/Magento
  • dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form

3 files changed

+26
-9
lines changed

app/code/Magento/Backend/Test/Unit/Model/Session/QuoteTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,10 @@ public function testGetQuoteWithoutQuoteId()
267267
$cartInterfaceMock->expects($this->atLeastOnce())->method('getId')->willReturn($quoteId);
268268
$defaultGroup = $this->getMockBuilder(\Magento\Customer\Api\Data\GroupInterface::class)->getMock();
269269
$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);
271274

272275
$dataCustomerMock = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)
273276
->disableOriginalConstructor()

app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Account.php

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,8 @@ protected function _prepareForm()
132132
$this->_addAttributesToForm($attributes, $fieldset);
133133

134134
$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);
142137
$this->_form->setValues($formValues);
143138

144139
return $this;
@@ -192,4 +187,23 @@ public function getFormValues()
192187

193188
return $data;
194189
}
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+
}
195209
}

dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AccountTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class AccountTest extends \PHPUnit\Framework\TestCase
4545
private $session;
4646

4747
/**
48-
* {@inheritdoc}
48+
* @inheritdoc
4949
*/
5050
protected function setUp()
5151
{

0 commit comments

Comments
 (0)