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


PHP factory\Factory类代码示例

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


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

示例1: _initData

 /**
  * Initialize fixture data
  *
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function _initData()
 {
     $this->_data['checkout'] = ['prices' => ['price_from' => 110, 'price_to' => 120], 'selection' => [0]];
     parent::_initData();
     $this->_data['fields'] = array_merge_recursive($this->_data['fields'], ['sku_type' => ['value' => 'Fixed', 'input_value' => '1', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'], 'price_type' => ['value' => 'Fixed', 'input_value' => '1', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'], 'price' => ['value' => 100, 'group' => static::GROUP_PRODUCT_DETAILS], 'tax_class_id' => ['value' => 'Taxable Goods', 'input_value' => '2', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'], 'weight_type' => ['value' => 'Fixed', 'input_value' => '1', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'], 'weight' => ['value' => '1', 'group' => static::GROUP_PRODUCT_DETAILS], 'product_website_1' => ['value' => 'Yes', 'input_value' => [1], 'group' => static::GROUP_PRODUCT_WEBSITE, 'input' => 'checkbox', 'input_name' => 'website_ids'], 'shipment_type' => ['value' => 'Separately', 'input_value' => '1', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'], 'bundle_selections' => ['value' => ['bundle_options' => [['title' => 'Drop-down Option', 'type' => 'Drop-down', 'required' => 'Yes', 'assigned_products' => [['search_data' => ['name' => '%item1_simple1::getName%'], 'data' => ['selection_price_value' => 10, 'selection_price_type' => 'Fixed', 'selection_qty' => 1, 'product_id' => '%item1_simple1::getProductId%']], ['search_data' => ['name' => '%item1_virtual2::getName%'], 'data' => ['selection_price_value' => 20, 'selection_price_type' => 'Percent', 'selection_qty' => 1, 'product_id' => '%item1_virtual2::getProductId%']]]]]], 'group' => static::GROUP]]);
     $this->_repository = Factory::getRepositoryFactory()->getMagentoBundleBundle($this->_dataConfig, $this->_data);
 }
开发者ID:,项目名称:,代码行数:12,代码来源:

示例2: testCreateNewLocalizedStoreView

 /**
  * @ZephyrId MAGETWO-12405
  */
 public function testCreateNewLocalizedStoreView()
 {
     $objectManager = Factory::getObjectManager();
     $storeFixture = $objectManager->create('Magento\\Store\\Test\\Fixture\\Store', ['dataSet' => 'german']);
     $storeListPage = Factory::getPageFactory()->getAdminSystemStore();
     $storeListPage->open();
     $storeListPage->getGridPageActions()->addStoreView();
     $newStorePage = Factory::getPageFactory()->getAdminSystemStoreNewStore();
     $newStorePage->getStoreForm()->fill($storeFixture);
     $newStorePage->getFormPageActions()->save();
     $storeListPage->getMessagesBlock()->waitSuccessMessage();
     $this->assertContains('The store view has been saved', $storeListPage->getMessagesBlock()->getSuccessMessages());
     $this->assertTrue($storeListPage->getStoreGrid()->isStoreExists($storeFixture->getName()));
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushCacheStorage();
     $cachePage->getMessagesBlock()->waitSuccessMessage();
     $configPage = Factory::getPageFactory()->getAdminSystemConfig();
     $configPage->open();
     $configPage->getPageActions()->selectStore($storeFixture->getGroupId() . "/" . $storeFixture->getName());
     $configGroup = $configPage->getForm()->getGroup('Locale Options');
     $configGroup->open();
     $configGroup->setValue('select-groups-locale-fields-code-value', 'German (Germany)');
     $configPage->getPageActions()->save();
     $configPage->getMessagesBlock()->waitSuccessMessage();
     $homePage = Factory::getPageFactory()->getCmsIndexIndex();
     $homePage->open();
     $homePage->getStoreSwitcherBlock()->selectStoreView($storeFixture->getName());
     $this->assertTrue($homePage->getSearchBlock()->isPlaceholderContains('Den gesamten Shop durchsuchen'));
 }
开发者ID:,项目名称:,代码行数:33,代码来源:

示例3: assertOnFrontend

 /**
  * Assert configurable product on Frontend
  *
  * @param ConfigurableProduct $product
  * @return void
  */
 protected function assertOnFrontend(ConfigurableProduct $product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()), 'Product is absent on category page.');
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $productListBlock->openProductViewPage($product->getName());
     $this->assertEquals($product->getName(), $productViewBlock->getProductName(), 'Product name does not correspond to specified.');
     $price = $product->getProductPrice();
     $priceOnPage = $productViewBlock->getPriceBlock()->getPrice();
     $this->assertEquals(number_format($price, 2), number_format($priceOnPage, 2), 'Product price does not correspond to specified.');
     $pageOptions = $productViewBlock->getOptions($product);
     $configurableOptions = [];
     foreach ($pageOptions['configurable_options'] as $attribute) {
         $configurableOption = [];
         foreach ($attribute['options'] as $option) {
             $configurableOption[] = $option['title'];
         }
         $configurableOptions[$attribute['title']] = $configurableOption;
     }
     $this->assertEquals($product->getConfigurableOptions(), $configurableOptions);
 }
开发者ID:,项目名称:,代码行数:36,代码来源:

示例4: testCreateConfigurableProduct

 /**
  * Edit configurable product and add new options to attribute
  *
  * @ZephyrId MAGETWO-12840
  * @return void
  */
 public function testCreateConfigurableProduct()
 {
     //Preconditions
     //Preparing Data for original product
     $configurable = Factory::getFixtureFactory()->getMagentoConfigurableProductConfigurableProduct();
     $configurable->switchData('configurable');
     $configurable->persist();
     $productSku = $configurable->getSku();
     //Preparing Data for editing product
     $editProduct = $configurable->getEditData();
     //Steps
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $productForm = $createProductPage->getProductForm();
     //Login
     Factory::getApp()->magentoBackendLoginUser();
     $productGridPage = Factory::getPageFactory()->getCatalogProductIndex();
     $productGridPage->open();
     //Search and open original configurable product
     $productGridPage->getProductGrid()->searchAndOpen(['sku' => $productSku]);
     //Editing product options
     $productForm->fill($editProduct);
     $createProductPage->getFormPageActions()->save();
     //Verifying
     $createProductPage->getMessagesBlock()->waitSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     //Verifying
     $this->assertOnGrid($editProduct);
     $this->assertOnFrontend($editProduct);
 }
开发者ID:,项目名称:,代码行数:38,代码来源:

示例5: assertOnCategory

 /**
  * Assert product data on category and product pages
  *
  * @param Product $product
  * @return void
  */
 protected function assertOnCategory($product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()));
     $productListBlock->openProductViewPage($product->getName());
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $this->assertEquals($product->getName(), $productViewBlock->getProductName());
     $price = $productViewBlock->getPriceBlock()->getPrice();
     $this->assertEquals(number_format($product->getProductPrice(), 2), $price);
     $productOptionsBlock = $productPage->getViewBlock()->getCustomOptionsBlock();
     $fixture = $product->getData('fields/custom_options/value');
     $actualOptions = $productOptionsBlock->getOptions($product);
     $this->assertCount(count($fixture), $actualOptions);
     $this->assertTrue(isset($actualOptions['custom_options'][$fixture[0]['title']]['options'][0]['title']));
     $this->assertEquals($fixture[0]['title'], $actualOptions['custom_options'][$fixture[0]['title']]['title']);
 }
开发者ID:,项目名称:,代码行数:31,代码来源:

示例6: initCustomRoles

 /**
  * Init most popular custom roles
  */
 protected function initCustomRoles()
 {
     $resourceFixture = Factory::getFixtureFactory()->getMagentoUserResource();
     $salesAllScopes = $this->_data['custom_permissions_all_scopes']['data'];
     $salesAllScopes['fields']['resource']['value'] = $resourceFixture->get('Magento_Sales::sales');
     $this->_data['sales_all_scopes']['data'] = $salesAllScopes;
 }
开发者ID:,项目名称:,代码行数:10,代码来源:

示例7: persist

 /**
  * Create product
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed|string
  */
 public function persist(FixtureInterface $fixture = null)
 {
     Factory::getApp()->magentoBackendLoginUser();
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $createProductPage->open(['type' => $fixture->getDataConfig()['create_url_params']['type'], 'set' => $fixture->getDataConfig()['create_url_params']['set']]);
     $createProductPage->getProductForm()->fill($fixture);
     $createProductPage->getFormPageActions()->save();
     $createProductPage->getMessagesBlock()->waitSuccessMessage();
 }
开发者ID:,项目名称:,代码行数:15,代码来源:

示例8: fillFormTab

 /**
  * Fill condition options
  *
  * @param array $fields
  * @param SimpleElement|null $element
  * @return void
  */
 public function fillFormTab(array $fields, SimpleElement $element = null)
 {
     $data = $this->dataMapping($fields);
     $conditionsBlock = Factory::getBlockFactory()->getMagentoCatalogRuleConditions($element->find($this->ruleConditions));
     $conditionsBlock->clickAddNew();
     $conditionsBlock->selectCondition($data['condition_type']['value']);
     $conditionsBlock->clickEllipsis();
     $conditionsBlock->selectConditionValue($data['condition_value']['value']);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:16,代码来源:Conditions.php

示例9: assertAbsenceOnCategory

 /**
  * Assert absence product on category page (frontend)
  *
  * @param Product $product
  * @return void
  */
 protected function assertAbsenceOnCategory(Product $product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     //Steps
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertFalse($productListBlock->isProductVisible($product->getName()));
 }
开发者ID:,项目名称:,代码行数:18,代码来源:

示例10: testForgotPassword

 /**
  * Reset password on frontend
  */
 public function testForgotPassword()
 {
     // Create Customer
     $customer = $this->objectManager->getInstance()->create('Magento\\Customer\\Test\\Fixture\\Customer', ['dataSet' => 'customer_US_1']);
     $customer->persist();
     $customerAccountLoginPage = Factory::getPageFactory()->getCustomerAccountLogin();
     $forgotPasswordPage = Factory::getPageFactory()->getCustomerAccountForgotpassword();
     $forgotPasswordPage->open();
     $forgotPasswordPage->getForgotPasswordForm()->resetForgotPassword($customer);
     //Verifying
     $message = sprintf('If there is an account associated with %s you will receive an email with a link to reset your password.', $customer->getEmail());
     $this->assertContains($message, $customerAccountLoginPage->getMessages()->getSuccessMessages());
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:16,代码来源:ForgotPasswordOnFrontendTest.php

示例11: persist

 /**
  * Execute handler
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed
  */
 public function persist(FixtureInterface $fixture = null)
 {
     /** @var \Magento\Customer\Test\Fixture\Address $fixture */
     // Pages
     $loginPage = Factory::getPageFactory()->getCustomerAccountLogin();
     $addressPage = Factory::getPageFactory()->getCustomerAddressEdit();
     $loginPage->open();
     if ($loginPage->getLoginBlock()->isVisible()) {
         $loginPage->getLoginBlock()->login($fixture->getCustomer());
     }
     $addressPage->open();
     $addressPage->getEditForm()->editCustomerAddress($fixture);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:19,代码来源:CreateAddress.php

示例12: persist

 /**
  * Login admin user
  *
  * @param FixtureInterface $fixture [optional]
  * @return void|mixed
  */
 public function persist(FixtureInterface $fixture = null)
 {
     if (null === $fixture) {
         $fixture = Factory::getFixtureFactory()->getMagentoBackendAdminSuperAdmin();
     }
     $loginPage = Factory::getPageFactory()->getAdminAuthLogin();
     $loginForm = $loginPage->getLoginBlock();
     $adminHeaderPanel = $loginPage->getHeaderBlock();
     if (!$adminHeaderPanel || !$adminHeaderPanel->isVisible()) {
         $loginPage->open();
         if ($adminHeaderPanel->isVisible()) {
             return;
         }
         $loginForm->fill($fixture);
         $loginForm->submit();
         $loginPage->waitForHeaderBlock();
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:24,代码来源:LoginUser.php

示例13: assertProductOnFrontend

 /**
  * Assert simple product on Frontend
  *
  * @param SimpleProduct $product
  * @return void
  */
 protected function assertProductOnFrontend(SimpleProduct $product)
 {
     //Pages
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $categoryPage = Factory::getPageFactory()->getCatalogCategoryView();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     $frontendHomePage->open();
     $frontendHomePage->getTopmenu()->selectCategoryByName($product->getNewCategoryName());
     //Verification on category product list
     $productListBlock = $categoryPage->getListProductBlock();
     $this->assertTrue($productListBlock->isProductVisible($product->getName()), 'Product is absent on category page.');
     //Verification on product detail page
     $productViewBlock = $productPage->getViewBlock();
     $productListBlock->openProductViewPage($product->getName());
     $this->assertEquals($product->getName(), $productViewBlock->getProductName());
     $price = $productViewBlock->getPriceBlock()->getPrice();
     $this->assertEquals(number_format($product->getProductPrice(), 2), $price);
 }
开发者ID:,项目名称:,代码行数:24,代码来源:

示例14: testCreateCustomer

 /**
  * New customer creation in backend
  *
  * @ZephyrId MAGETWO-12516
  */
 public function testCreateCustomer()
 {
     //Data
     $customerFixture = Factory::getFixtureFactory()->getMagentoCustomerCustomer();
     $customerFixture->switchData('backend_customer');
     $searchData = ['email' => $customerFixture->getEmail()];
     //Pages
     $customerPage = Factory::getPageFactory()->getCustomerIndex();
     $customerCreatePage = Factory::getPageFactory()->getCustomerIndexNew();
     //Steps
     $customerPage->open();
     $customerPage->getPageActionsBlock()->addNew();
     $customerCreatePage->getCustomerForm()->fillCustomer($customerFixture);
     $customerCreatePage->getPageActionsBlock()->saveAndContinue();
     $customerCreatePage->getMessagesBlock()->waitSuccessMessage();
     //Verifying
     $customerPage->open();
     $this->assertTrue($customerPage->getCustomerGridBlock()->isRowVisible($searchData), 'Customer email "' . $searchData['email'] . '" not found in the grid');
 }
开发者ID:,项目名称:,代码行数:24,代码来源:

示例15: assertOnTheFrontEnd

 /**
  * @param Product $product
  * @param Product[] $assigned
  * @return void
  */
 protected function assertOnTheFrontEnd(Product $product, array $assigned)
 {
     /** @var Product $simple2 */
     /** @var Product $configurable */
     list($simple2, $configurable) = $assigned;
     //Open up simple1 product page
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     Factory::getClientBrowser()->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->assertEquals($product->getName(), $productPage->getViewBlock()->getProductName());
     /** @var \Magento\Catalog\Test\Block\Product\ProductList\Upsell $upsellBlock */
     $upsellBlock = $productPage->getUpsellBlock();
     //Verify upsell simple2 and configurable on Simple1 product page
     $this->assertTrue($upsellBlock->isUpsellProductVisible($simple2->getName()));
     $this->assertTrue($upsellBlock->isUpsellProductVisible($configurable->getName()));
     //Open and verify configurable page
     $upsellBlock->openUpsellProduct($configurable->getName());
     $this->assertEquals($configurable->getName(), $productPage->getViewBlock()->getProductName());
     //Verify upsell simple2 on Configurable product page and open it
     $upsellBlock = $productPage->getUpsellBlock();
     $this->assertTrue($upsellBlock->isUpsellProductVisible($simple2->getName()));
     $upsellBlock->openUpsellProduct($simple2->getName());
     $this->assertEquals($simple2->getName(), $productPage->getViewBlock()->getProductName());
     $this->assertFalse($productPage->getUpsellBlock()->isVisible());
 }
开发者ID:,项目名称:,代码行数:29,代码来源:


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