本文整理汇总了PHP中Magento\Customer\Test\Fixture\Customer::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::getData方法的具体用法?PHP Customer::getData怎么用?PHP Customer::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Customer\Test\Fixture\Customer
的用法示例。
在下文中一共展示了Customer::getData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareVatConfig
/**
* Prepare VAT ID confguration.
*
* @param ConfigData $vatConfig
* @param string $customerGroup
* @return void
*/
protected function prepareVatConfig(ConfigData $vatConfig, $customerGroup)
{
$groupConfig = ['customer/create_account/viv_domestic_group' => ['value' => $this->vatGroups['valid_domestic_group']->getCustomerGroupId()], 'customer/create_account/viv_intra_union_group' => ['value' => $this->vatGroups['valid_intra_union_group']->getCustomerGroupId()], 'customer/create_account/viv_invalid_group' => ['value' => $this->vatGroups['invalid_group']->getCustomerGroupId()], 'customer/create_account/viv_error_group' => ['value' => $this->vatGroups['error_group']->getCustomerGroupId()]];
$vatConfig = $this->fixtureFactory->createByCode('configData', ['data' => array_replace_recursive($vatConfig->getSection(), $groupConfig)]);
$vatConfig->persist();
$customerData = array_merge($this->customer->getData(), ['group_id' => ['value' => $this->vatGroups[$customerGroup]->getCustomerGroupCode()]], ['address' => ['addresses' => $this->customer->getDataFieldConfig('address')['source']->getAddresses()]]);
$this->customer = $this->fixtureFactory->createByCode('customer', ['data' => $customerData]);
}
示例2: processAssert
/**
* Assert customer availability in Customer Grid
*
* @param Customer $customer
* @param CustomerIndex $pageCustomerIndex
* @param Customer $initialCustomer [optional]
* @return void
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function processAssert(Customer $customer, CustomerIndex $pageCustomerIndex, Customer $initialCustomer = null)
{
if ($initialCustomer) {
$customer = $customer->hasData() ? array_merge($initialCustomer->getData(), $customer->getData()) : $initialCustomer->getData();
} else {
$customer = $customer->getData();
}
$name = (isset($customer['prefix']) ? $customer['prefix'] . ' ' : '') . $customer['firstname'] . (isset($customer['middlename']) ? ' ' . $customer['middlename'] : '') . ' ' . $customer['lastname'] . (isset($customer['suffix']) ? ' ' . $customer['suffix'] : '');
$filter = ['name' => $name, 'email' => $customer['email']];
$pageCustomerIndex->open();
\PHPUnit_Framework_Assert::assertTrue($pageCustomerIndex->getCustomerGridBlock()->isRowVisible($filter), 'Customer with ' . 'name \'' . $filter['name'] . '\', ' . 'email \'' . $filter['email'] . '\' ' . 'is absent in Customer grid.');
}
示例3: prepareCustomer
/**
* Prepares customer returned after test.
*
* @param Customer $customer
* @param Customer $initialCustomer
* @param Address|null $address
* @param Address|null $addressToDelete
* @return Customer
*/
private function prepareCustomer(Customer $customer, Customer $initialCustomer, Address $address = null, Address $addressToDelete = null)
{
$data = $customer->hasData() ? array_replace_recursive($initialCustomer->getData(), $customer->getData()) : $initialCustomer->getData();
$groupId = $customer->hasData('group_id') ? $customer : $initialCustomer;
$data['group_id'] = ['customerGroup' => $groupId->getDataFieldConfig('group_id')['source']->getCustomerGroup()];
if ($initialCustomer->hasData('address')) {
$addressesList = $initialCustomer->getDataFieldConfig('address')['source']->getAddresses();
foreach ($addressesList as $key => $addressFixture) {
if ($addressToDelete === null || $addressFixture != $address) {
$data['address'] = ['addresses' => [$key => $addressFixture]];
}
}
}
if ($address !== null) {
$data['address']['addresses'][] = $address;
}
return $this->fixtureFactory->createByCode('customer', ['data' => $data]);
}
示例4: prepareData
/**
* Prepare customer data for Web API.
*
* @param Customer $customer
* @return array
*/
protected function prepareData(Customer $customer)
{
$data['customer'] = $this->replaceMappingData($customer->getData());
$data['customer']['group_id'] = $this->getCustomerGroup($customer);
$data['password'] = $data['customer']['password'];
unset($data['customer']['password']);
unset($data['customer']['password_confirmation']);
$data = $this->prepareAddressData($data);
return $data;
}
示例5: getValidationMessages
/**
* Get all error validation messages for fields.
*
* @param Customer $customer
* @return array
*/
public function getValidationMessages(Customer $customer)
{
$messages = [];
foreach (array_keys($customer->getData()) as $field) {
$element = $this->_rootElement->find(sprintf($this->validationText, str_replace('_', '-', $field)));
if ($element->isVisible()) {
$messages[$field] = $element->getText();
}
}
return $messages;
}
示例6: processAssert
/**
* Assert that displayed customer data on edit page(backend) equals passed from fixture
*
* @param Customer $customer
* @param CustomerIndex $pageCustomerIndex
* @param CustomerIndexEdit $pageCustomerIndexEdit
* @param Address $address[optional]
* @param Customer $initialCustomer [optional]
* @return void
*/
public function processAssert(Customer $customer, CustomerIndex $pageCustomerIndex, CustomerIndexEdit $pageCustomerIndexEdit, Address $address = null, Customer $initialCustomer = null)
{
$data = [];
$filter = [];
if ($initialCustomer) {
$data['customer'] = $customer->hasData() ? array_merge($initialCustomer->getData(), $customer->getData()) : $initialCustomer->getData();
} else {
$data['customer'] = $customer->getData();
}
if ($address) {
$data['addresses'][1] = $address->hasData() ? $address->getData() : [];
} else {
$data['addresses'] = [];
}
$filter['email'] = $data['customer']['email'];
$pageCustomerIndex->open();
$pageCustomerIndex->getCustomerGridBlock()->searchAndOpen($filter);
$dataForm = $pageCustomerIndexEdit->getCustomerForm()->getDataCustomer($customer, $address);
$dataDiff = $this->verify($data, $dataForm);
\PHPUnit_Framework_Assert::assertTrue(empty($dataDiff), 'Customer data on edit page(backend) not equals to passed from fixture.' . "\nFailed values: " . implode(', ', $dataDiff));
}
示例7: prepareCustomerData
/**
* Prepare customer data.
*
* @param array $data
* @return array
*/
protected function prepareCustomerData(array $data)
{
return ['currency_id' => $data['base_currency_code'], 'customer_id' => $this->customer->getData('id'), 'payment' => $data['payment_authorization_amount'], 'store_id' => $this->order->getDataFieldConfig('store_id')['source']->store->getStoreId()];
}
示例8: saveCustomer
/**
* Save new customer and get form key
*
* @param \Magento\Customer\Test\Fixture\Customer $fixture
* @return CurlTransport
*/
protected function saveCustomer(\Magento\Customer\Test\Fixture\Customer $fixture)
{
$data = $fixture->getData('fields');
$fields = array();
foreach ($data as $key => $field) {
$fields[$key] = $field['value'];
}
$url = $_ENV['app_frontend_url'] . $this->saveCustomer;
$curl = new CurlTransport();
$curl->write(CurlInterface::POST, $url, '1.0', array(), $fields);
$curl->read();
$urlForm = $_ENV['app_frontend_url'] . $this->addressNew;
$curl->write(CurlInterface::GET, $urlForm, '1.0', array());
$response = $curl->read();
$this->formKey = $this->getFromKey($response);
return $curl;
}
示例9: prepareCustomer
/**
* Prepares customer returned after test.
*
* @param Customer $customer
* @param Customer $initialCustomer
* @return Customer
*/
private function prepareCustomer(Customer $customer, Customer $initialCustomer)
{
if (!$customer->hasData()) {
return $initialCustomer;
}
$data = array_replace_recursive($initialCustomer->getData(), $customer->getData());
$data['group_id'] = ['customerGroup' => $initialCustomer->getDataFieldConfig('group_id')['source']->getCustomerGroup()];
return $this->fixtureFactory->createByCode('customer', ['data' => $data]);
}