Skip to content
This repository has been archived by the owner on Apr 29, 2019. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'trigger/MAGETWO-90280' into BugFixPR
Browse files Browse the repository at this point in the history
  • Loading branch information
Joan He committed Oct 5, 2018
2 parents cfba0ed + 467ee16 commit 41f2669
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/code/Magento/Customer/Model/AccountManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ public function createAccountWithPasswordHash(CustomerInterface $customer, $hash
if ($customer->getWebsiteId()) {
$storeId = $this->storeManager->getWebsite($customer->getWebsiteId())->getDefaultStore()->getId();
} else {
$this->storeManager->setCurrentStore(null);
$storeId = $this->storeManager->getStore()->getId();
}
$customer->setStoreId($storeId);
Expand Down Expand Up @@ -1011,7 +1012,7 @@ protected function createPasswordHash($password)
}

/**
* Returns eval validator
* Get EAV validator
*
* @return Backend
*/
Expand Down Expand Up @@ -1216,7 +1217,7 @@ protected function getWebsiteStoreId($customer, $defaultStoreId = null)
}

/**
* Return array with template types
* Get template types
*
* @return array
* @deprecated 100.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,34 @@ public function testCreateCustomerWithErrors()
}
}

public function testCreateCustomerWithoutOptionalFields()
{
$serviceInfo = [
'rest' => [
'resourcePath' => self::RESOURCE_PATH,
'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ],
'soap' => [
'service' => self::SERVICE_NAME,
'serviceVersion' => self::SERVICE_VERSION,
'operation' => self::SERVICE_NAME . 'CreateAccount',
],
];

$customerDataArray = $this->dataObjectProcessor->buildOutputDataArray(
$this->customerHelper->createSampleCustomerDataObject(),
\Magento\Customer\Api\Data\CustomerInterface::class
);
unset($customerDataArray['store_id']);
unset($customerDataArray['website_id']);
$requestData = ['customer' => $customerDataArray, 'password' => CustomerHelper::PASSWORD];
try {
$customerData = $this->_webApiCall($serviceInfo, $requestData, null, 'all');
$this->assertNotNull($customerData['id']);
} catch (\Exception $e) {
$this->fail('Customer should be created without optional fields.');
}
}

/**
* Test customer activation when it is required
*
Expand Down

0 comments on commit 41f2669

Please sign in to comment.