本文整理汇总了PHP中Magento\Customer\Test\Fixture\Customer::hasData方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::hasData方法的具体用法?PHP Customer::hasData怎么用?PHP Customer::hasData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Customer\Test\Fixture\Customer
的用法示例。
在下文中一共展示了Customer::hasData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectCustomer
/**
* Select customer if it is present in fixture or click create new customer button.
*
* @param CustomerFixture $customer
* @return void
*/
public function selectCustomer(CustomerFixture $customer)
{
if ($customer->hasData('id')) {
$this->searchAndOpen(['email' => $customer->getEmail()]);
} else {
$this->_rootElement->find($this->createNewCustomer)->click();
}
$this->getTemplateBlock()->waitLoader();
}
示例2: 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));
}
示例3: 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;
}
示例4: 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]);
}
示例5: 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;
}
示例6: 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]);
}