当前位置: 首页>>代码示例>>PHP>>正文


PHP Customer::hasData方法代码示例

本文整理汇总了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();
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:15,代码来源:Customer.php

示例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));
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:31,代码来源:AssertCustomerForm.php

示例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;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:Curl.php

示例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]);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:27,代码来源:UpdateCustomerBackendEntityTest.php

示例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;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:10,代码来源:Webapi.php

示例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]);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:16,代码来源:UpdateCustomerFrontendEntityTest.php


注:本文中的Magento\Customer\Test\Fixture\Customer::hasData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。