• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Fixture\Customer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Customer\Test\Fixture\Customer的典型用法代码示例。如果您正苦于以下问题:PHP Customer类的具体用法?PHP Customer怎么用?PHP Customer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Customer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Create customer
  *
  * @return array
  */
 public function run()
 {
     if ($this->persistCustomer) {
         $this->customer->persist();
     }
     return ['customer' => $this->customer];
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:12,代码来源:CreateCustomerStep.php


示例2: test

 /**
  * Mass assign customer group
  *
  * @param Customer $customer
  * @param CustomerGroup $customerGroup
  * @return void
  */
 public function test(Customer $customer, CustomerGroup $customerGroup)
 {
     // Steps
     $customerGroup->persist();
     $this->customerIndex->open();
     $this->customerIndex->getCustomerGridBlock()->massaction([['email' => $customer->getEmail()]], [$this->customersGridActions => $customerGroup->getCustomerGroupCode()]);
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:14,代码来源:MassAssignCustomerGroupTest.php


示例3: processAssert

 /**
  * Assertion that tier prices are displayed correctly for specified customer
  *
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param Customer $customer
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogProductView $catalogProductView, FixtureInterface $product, Customer $customer)
 {
     $customer->persist();
     $this->loginCustomer($customer);
     $productTierPriceAssert = $this->objectManager->get('Magento\\Catalog\\Test\\Constraint\\AssertProductTierPriceOnProductPage');
     $productTierPriceAssert->processAssert($browser, $catalogProductView, $product);
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:16,代码来源:AssertProductTierPriceOnProductPageWithCustomer.php


示例4: test

 /**
  * Create customer.
  *
  * @param Customer $customer
  * @param CustomerAccountForgotPassword $forgotPassword
  * @return void
  */
 public function test(Customer $customer, CustomerAccountForgotPassword $forgotPassword)
 {
     // Precondition
     $customer->persist();
     // Steps
     $forgotPassword->open();
     $forgotPassword->getForgotPasswordForm()->resetForgotPassword($customer);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:ForgotPasswordOnFrontendTest.php


示例5: 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]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:AbstractApplyVatIdTest.php


示例6: test

 /**
  * Run reset customer password failed test.
  * @param Customer $customer
  * @param int $attempts
  * @return void
  */
 public function test(Customer $customer, $attempts)
 {
     // Steps
     $customer->persist();
     for ($i = 0; $i < $attempts; $i++) {
         $this->forgotPassword->open();
         $this->forgotPassword->getForgotPasswordForm()->resetForgotPassword($customer);
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:ResetCustomerPasswordFailedTest.php


示例7: __inject

 /**
  * Injection data
  *
  * @param CustomerAccountCreate $customerAccountCreate
  * @param CustomerAccountLogout $customerAccountLogout
  * @param CmsIndex $cmsIndex
  * @param Customer $customer
  * @return array
  */
 public function __inject(CustomerAccountCreate $customerAccountCreate, CustomerAccountLogout $customerAccountLogout, CmsIndex $cmsIndex, Customer $customer)
 {
     $this->customerAccountLogout = $customerAccountLogout;
     $this->customerAccountCreate = $customerAccountCreate;
     $this->cmsIndex = $cmsIndex;
     //Precondition
     $customer->persist();
     return ['customer' => $customer];
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:CreateExistingCustomerFrontendEntity.php


示例8: 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


示例9: processAssert

 /**
  * Assert that products added to wishlist are present on Customers account on backend.
  *
  * @param CustomerIndex $customerIndex
  * @param Customer $customer
  * @param CustomerIndexEdit $customerIndexEdit
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CustomerIndex $customerIndex, Customer $customer, CustomerIndexEdit $customerIndexEdit, InjectableFixture $product)
 {
     $customerIndex->open();
     $customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]);
     $customerIndexEdit->getCustomerForm()->openTab('wishlist');
     /** @var \Magento\Wishlist\Test\Block\Adminhtml\Customer\Edit\Tab\Wishlist\Grid $wishlistGrid */
     $wishlistGrid = $customerIndexEdit->getCustomerForm()->getTab('wishlist')->getSearchGridBlock();
     \PHPUnit_Framework_Assert::assertTrue($wishlistGrid->isRowVisible(['product_name' => $product->getName()]), $product->getName() . " is not visible in customer wishlist on backend.");
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:AssertProductIsPresentInCustomerBackendWishlist.php


示例10: test

 /**
  * Create customer on backend.
  *
  * @param Customer $customer
  * @return void
  */
 public function test(Customer $customer)
 {
     // Precondition
     $customer->persist();
     // Steps
     $this->pageCustomerIndex->open();
     $this->pageCustomerIndex->getPageActionsBlock()->addNew();
     $this->pageCustomerIndexNew->getCustomerForm()->fillCustomer($customer);
     $this->pageCustomerIndexNew->getPageActionsBlock()->save();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:CreateExistingCustomerBackendEntity.php


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


示例12: test

 /**
  * New Accounts Report.
  *
  * @param Customer $customer
  * @param array $customersReport
  * @return void
  */
 public function test(Customer $customer, array $customersReport)
 {
     // Preconditions
     $this->customerIndexPage->open();
     $this->customerIndexPage->getCustomerGridBlock()->massaction([], 'Delete', true, 'Select All');
     $customer->persist();
     // Steps
     $this->customerAccounts->open();
     $this->customerAccounts->getGridBlock()->searchAccounts($customersReport);
 }
开发者ID:niranjanssiet,项目名称:magento2,代码行数:17,代码来源:NewAccountsReportEntityTest.php


示例13: testDeleteCustomerBackendEntity

 /**
  * Runs Delete Customer Backend Entity test
  *
  * @param Customer $customer
  * @return void
  */
 public function testDeleteCustomerBackendEntity(Customer $customer)
 {
     // Preconditions:
     $customer->persist();
     // Steps:
     $filter = ['email' => $customer->getEmail()];
     $this->customerIndexPage->open();
     $this->customerIndexPage->getCustomerGridBlock()->searchAndOpen($filter);
     $this->customerIndexEditPage->getPageActionsBlock()->delete();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:16,代码来源:DeleteCustomerBackendEntityTest.php


示例14: test

 /**
  * Create product and add it to cart.
  *
  * @param string $products
  * @param Customer $customer
  * @return array
  */
 public function test($products, Customer $customer)
 {
     // Precondition
     $products = $this->createProducts($products);
     $customer->persist();
     $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     $this->addProductsToCart($products);
     $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LogoutCustomerOnFrontendStep', ['customer' => $customer])->run();
     return ['products' => $products];
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:AbandonedCartsReportEntityTest.php


示例15: testCreateExistingCustomer

 /**
  * Create Existing Customer account on frontend.
  *
  * @param Customer $customer
  * @return void
  */
 public function testCreateExistingCustomer(Customer $customer)
 {
     // Precondition
     $existingCustomer = clone $customer;
     $customer->persist();
     // Steps
     $this->cmsIndex->open();
     $this->cmsIndex->getLinksBlock()->openLink('Create an Account');
     $this->customerAccountCreate->getRegisterForm()->registerCustomer($existingCustomer);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:CreateExistingCustomerFrontendEntity.php


示例16: testUpdateCustomerBackendEntity

 /**
  * Run update customer test.
  *
  * @param Customer $initialCustomer
  * @param Customer $customer
  * @param Address $address [optional]
  * @return void
  */
 public function testUpdateCustomerBackendEntity(Customer $initialCustomer, Customer $customer, Address $address = null)
 {
     // Precondition
     $initialCustomer->persist();
     // Steps
     $filter = ['email' => $initialCustomer->getEmail()];
     $this->customerIndexPage->open();
     $this->customerIndexPage->getCustomerGridBlock()->searchAndOpen($filter);
     $this->customerIndexEditPage->getCustomerForm()->updateCustomer($customer, $address);
     $this->customerIndexEditPage->getPageActionsBlock()->save();
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:19,代码来源:UpdateCustomerBackendEntityTest.php


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


示例18: processAssert

 /**
  * Assert that deleted customers address is not displayed on backend during order creation
  *
  * @param OrderIndex $orderIndex
  * @param OrderCreateIndex $orderCreateIndex
  * @param Address $deletedAddress
  * @param Customer $customer
  * @return void
  */
 public function processAssert(OrderIndex $orderIndex, OrderCreateIndex $orderCreateIndex, Address $deletedAddress, Customer $customer)
 {
     $filter = ['email' => $customer->getEmail()];
     $orderIndex->open()->getGridPageActions()->addNew();
     $orderCreateIndex->getCustomerBlock()->searchAndOpen($filter);
     $orderCreateIndex->getStoreBlock()->selectStoreView();
     $actualAddresses = $orderCreateIndex->getCreateBlock()->getBillingAddressBlock()->getExistingAddresses();
     $addressRenderer = $this->objectManager->create('Magento\\Customer\\Test\\Block\\Address\\Renderer', ['address' => $deletedAddress]);
     $addressToSearch = $addressRenderer->render();
     \PHPUnit_Framework_Assert::assertFalse(in_array($addressToSearch, $actualAddresses), 'Deleted address is present on backend during order creation');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:20,代码来源:AssertAddressDeletedBackend.php


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


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Adminhtml\CustomerIndex类代码示例发布时间:2022-05-23
下一篇:
PHP Model\Session类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap