本文整理汇总了PHP中Magento\Customer\Test\Fixture\Customer::getDataFieldConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::getDataFieldConfig方法的具体用法?PHP Customer::getDataFieldConfig怎么用?PHP Customer::getDataFieldConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Customer\Test\Fixture\Customer
的用法示例。
在下文中一共展示了Customer::getDataFieldConfig方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: run
/**
* Fill customer addresses and proceed to next step.
*
* @return void
*/
public function run()
{
$addresses = $this->customer->getDataFieldConfig('address')['source']->getAddresses();
$bindings = [];
foreach ($this->products as $key => $product) {
$productName = $product->getName();
$addressRender = $this->objectManager->create(\Magento\Customer\Test\Block\Address\Renderer::class, ['address' => $addresses[$key], 'type' => 'oneline']);
$bindings[$productName] = $addressRender->render();
}
$this->addresses->getAddressesBlock()->selectAddresses($bindings);
}
示例3: applyCustomerGroup
/**
* Create customer with customer group and apply customer group to catalog price rule.
*
* @param CatalogRule $catalogPriceRule
* @param Customer|null $customer
* @return CustomerGroup
*/
public function applyCustomerGroup(CatalogRule $catalogPriceRule, Customer $customer = null)
{
if ($customer !== null) {
$customer->persist();
/** @var \Magento\Customer\Test\Fixture\CustomerGroup $customerGroup */
$customerGroup = $customer->getDataFieldConfig('group_id')['source']->getCustomerGroup();
$catalogPriceRule = $this->fixtureFactory->createByCode('catalogRule', ['data' => array_merge($catalogPriceRule->getData(), ['customer_group_ids' => $customerGroup->getCustomerGroupCode()])]);
}
return $catalogPriceRule;
}
示例4: test
/**
* Runs Delete Customer Address test.
*
* @param Customer $customer
* @return array
*/
public function test(Customer $customer)
{
// Precondition:
$customer->persist();
$addressToDelete = $customer->getDataFieldConfig('address')['source']->getAddresses()[1];
// Steps:
$this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
$this->customerAccountIndex->getAccountMenuBlock()->openMenuItem('Address Book');
$this->customerAccountIndex->getAdditionalAddressBlock()->deleteAdditionalAddress($addressToDelete);
return ['deletedAddress' => $addressToDelete];
}
示例5: test
/**
* Runs Delete Customer Address test.
*
* @param Customer $customer
* @return array
*/
public function test(Customer $customer)
{
$this->markTestIncomplete('Bug: MAGETWO-34634');
// Precondition:
$customer->persist();
$addressToDelete = $customer->getDataFieldConfig('address')['source']->getAddresses()[1];
// Steps:
$this->cmsIndex->open();
$this->cmsIndex->getLinksBlock()->openLink("Log In");
$this->customerAccountLogin->getLoginBlock()->login($customer);
$this->customerAccountIndex->getAccountMenuBlock()->openMenuItem('Address Book');
$this->customerAccountIndex->getAdditionalAddressBlock()->deleteAdditionalAddress($addressToDelete);
return ['deletedAddress' => $addressToDelete];
}
示例6: test
/**
* Delete Customer Group.
*
* @param CustomerGroup $customerGroup
* @param Customer $customer [optional]
* @return array
*/
public function test(CustomerGroup $customerGroup, Customer $customer = null)
{
// Precondition
if ($customer !== null) {
$customer->persist();
$customerGroup = $customer->getDataFieldConfig('group_id')['source']->getCustomerGroup();
} else {
$customerGroup->persist();
}
// Steps
$filter = ['code' => $customerGroup->getCustomerGroupCode()];
$this->customerGroupIndex->open();
$this->customerGroupIndex->getCustomerGroupGrid()->searchAndOpen($filter);
$this->customerGroupNew->getPageMainActions()->delete();
$this->customerGroupNew->getModalBlock()->acceptAlert();
return ['customer' => $customer, 'customerGroup' => $customerGroup];
}
示例7: prepareOrderData
/**
* Prepare order data.
*
* @param array $data
* @return array
*/
protected function prepareOrderData(array $data)
{
$customerGroupId = $this->customer->hasData('group_id') ? $this->customer->getDataFieldConfig('group_id')['source']->getCustomerGroup()->getCustomerGroupId() : 1;
$result = ['name' => $this->customer->getFirstname(), 'order' => ['currency' => $data['order_currency_code'], 'account' => ['group_id' => $customerGroupId, 'email' => $this->customer->getEmail()], 'shipping_method' => isset($data['shipping_method']) ? $data['shipping_method'] : ''], 'item' => $this->prepareOrderProductsData($data['entity_id']), 'billing_address' => $this->prepareBillingAddress($data['billing_address_id']), 'shipping_same_as_billing' => 'on', 'payment' => $data['payment_auth_expiration']];
return $result;
}
示例8: testUpdateCustomerBackendEntity
/**
* Run update customer test.
*
* @param Customer $initialCustomer
* @param Customer $customer
* @param Address|null $address
* @param int|null $addressIndexToDelete
* @throws \Exception
* @return array
*/
public function testUpdateCustomerBackendEntity(Customer $initialCustomer, Customer $customer, Address $address = null, $addressIndexToDelete = null)
{
// Precondition
$initialCustomer->persist();
$addressToDelete = null;
if ($addressIndexToDelete !== null) {
$addressToDelete = $initialCustomer->getDataFieldConfig('address')['source']->getAddresses()[$addressIndexToDelete];
}
// Steps
$filter = ['email' => $initialCustomer->getEmail()];
$this->customerIndexPage->open();
$this->customerIndexPage->getCustomerGridBlock()->searchAndOpen($filter);
$this->customerIndexEditPage->getCustomerForm()->updateCustomer($customer, $address, $addressToDelete);
$this->customerIndexEditPage->getPageActionsBlock()->save();
return ['customer' => $this->prepareCustomer($customer, $initialCustomer, $address, $addressToDelete), 'addressToDelete' => $addressToDelete];
}
示例9: getCustomerGroup
/**
* Get customer group.
*
* @param Customer $customer
* @return string
*/
protected function getCustomerGroup(Customer $customer)
{
return $customer->hasData('group_id') ? $customer->getDataFieldConfig('group_id')['source']->getCustomerGroup()->getCustomerGroupId() : self::GENERAL_GROUP;
}
示例10: 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]);
}