本文整理汇总了PHP中Magento\Customer\Test\Fixture\Customer类的典型用法代码示例。如果您正苦于以下问题:PHP Customer类的具体用法?PHP Customer怎么用?PHP Customer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Customer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Create customer
*
* @return array
*/
public function run()
{
if ($this->persistCustomer) {
$this->customer->persist();
}
return ['customer' => $this->customer];
}
示例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()]);
}
示例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);
}
示例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]);
}
示例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);
}
}
示例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];
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
示例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();
}
示例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];
}
示例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);
}