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


PHP Factory::getFixtureFactory方法代码示例

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


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

示例1: testCreateUpsell

 /**
  * Product Up-selling.  Assign upselling to products and see them related on the front-end.
  *
  * @ZephirId MAGETWO-12391
  * @return void
  */
 public function testCreateUpsell()
 {
     // Precondition: create simple product 1
     $simple1 = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $simple1->switchData('simple');
     $simple1->persist();
     $assignToSimple1 = Factory::getFixtureFactory()->getMagentoCatalogUpsellProducts();
     $assignToSimple1->switchData('add_up_sell_products');
     $verify = [$assignToSimple1->getProduct('simple'), $assignToSimple1->getProduct('configurable')];
     //Data
     $productGridPage = Factory::getPageFactory()->getCatalogProductIndex();
     $editProductPage = Factory::getPageFactory()->getCatalogProductEdit();
     //Steps
     $productGridPage->open();
     $productGridPage->getProductGrid()->searchAndOpen(['sku' => $simple1->getSku()]);
     $editProductPage->getProductForm()->fill($assignToSimple1);
     $editProductPage->getFormPageActions()->save();
     $editProductPage->getMessagesBlock()->waitSuccessMessage();
     $productGridPage->open();
     $productGridPage->getProductGrid()->searchAndOpen(['sku' => $assignToSimple1->getProduct('configurable')->getSku()]);
     $assignToSimple1->switchData('add_up_sell_product');
     $productForm = $editProductPage->getProductForm();
     $productForm->fill($assignToSimple1);
     $editProductPage->getFormPageActions()->save();
     $editProductPage->getMessagesBlock()->waitSuccessMessage();
     $this->assertOnTheFrontend($simple1, $verify);
 }
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: 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,代码来源:

示例3: 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,代码来源:

示例4: testCreate

 /**
  * Creating bundle (dynamic) product and assigning it to the category
  *
  * @ZephyrId MAGETWO-12702
  * @return void
  */
 public function testCreate()
 {
     //Data
     $bundle = Factory::getFixtureFactory()->getMagentoBundleBundleDynamic();
     $bundle->switchData('bundle');
     //Pages & Blocks
     $manageProductsGrid = Factory::getPageFactory()->getCatalogProductIndex();
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $productForm = $createProductPage->getProductForm();
     //Steps
     $manageProductsGrid->open();
     $manageProductsGrid->getGridPageActionBlock()->addProduct('bundle');
     $category = $bundle->getCategories()['category'];
     $productForm->fill($bundle, null, $category);
     $createProductPage->getFormPageActions()->save();
     //Verification
     $createProductPage->getMessagesBlock()->waitSuccessMessage();
     // Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->waitSuccessMessage();
     //Verification
     $this->assertOnGrid($bundle);
     $this->assertOnCategory($bundle);
 }
开发者ID:,项目名称:,代码行数:32,代码来源:

示例5: testEditBundle

 /**
  * Edit bundle
  *
  * @dataProvider createDataProvider
  * @ZephyrId MAGETWO-12842
  * @ZephyrId MAGETWO-12841
  *
  * @param $fixture
  * @return void
  */
 public function testEditBundle($fixture)
 {
     //Data
     /** @var $product \Magento\Bundle\Test\Fixture\Bundle */
     /** @var $editProduct \Magento\Bundle\Test\Fixture\Bundle */
     $product = Factory::getFixtureFactory()->{$fixture}();
     $product->switchData('bundle');
     $product->persist();
     $editProduct = Factory::getFixtureFactory()->{$fixture}();
     $editProduct->switchData('bundle_edit_required_fields');
     $productGridPage = Factory::getPageFactory()->getCatalogProductIndex();
     $gridBlock = $productGridPage->getProductGrid();
     $editProductPage = Factory::getPageFactory()->getCatalogProductEdit();
     $productForm = $editProductPage->getProductForm();
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $productGridPage->open();
     $gridBlock->searchAndOpen(['sku' => $product->getSku(), 'type' => 'Bundle Product']);
     $productForm->fill($editProduct);
     $editProductPage->getFormPageActions()->save();
     //Verifying
     $editProductPage->getMessagesBlock()->waitSuccessMessage();
     // Flush cache
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     //Verifying
     $this->assertOnGrid($editProduct);
     $this->assertOnCategory($editProduct, $product->getCategoryName());
 }
开发者ID:,项目名称:,代码行数:38,代码来源:

示例6: testCreateProduct

 /**
  * Test product create
  *
  * @ZephyrId MAGETWO-13345
  * @return void
  */
 public function testCreateProduct()
 {
     //Data
     $product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $product->switchData('simple_with_new_category');
     //Page & Blocks
     $productListPage = Factory::getPageFactory()->getCatalogProductIndex();
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $addProductBlock = $productListPage->getGridPageActionBlock();
     $productForm = $createProductPage->getProductForm();
     //Steps
     $productListPage->open();
     $addProductBlock->addProduct();
     $productForm->fill($product);
     $productForm->addNewCategory($product);
     $createProductPage->getFormPageActions()->save();
     //Verifying
     $this->assertSuccessMessage("You saved the product.");
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->waitSuccessMessage();
     //Verifying
     $this->assertProductOnFrontend($product);
 }
开发者ID:,项目名称:,代码行数:32,代码来源:

示例7: roleProvider

 /**
  * Retrieve specify data from role.trieve specify data from role.
  *
  * @param $roleName
  * @return mixed
  */
 protected function roleProvider($roleName)
 {
     $role = Factory::getFixtureFactory()->getMagentoUserRole();
     $role->switchData($roleName);
     $data = $role->persist();
     return $data['id'];
 }
开发者ID:,项目名称:,代码行数:13,代码来源:

示例8: attributeProvider

 /**
  * Create new configurable attribute and add it to product
  *
  * @return string
  */
 protected function attributeProvider()
 {
     $attribute = Factory::getFixtureFactory()->getMagentoCatalogProductAttribute();
     $attribute->switchData('configurable_attribute');
     $attribute->persist();
     $this->_dataConfig['attributes']['id'][] = $attribute->getAttributeId();
     $this->_dataConfig['attributes'][$attribute->getAttributeId()]['code'] = $attribute->getAttributeCode();
     $this->_dataConfig['options'][$attribute->getAttributeId()]['id'] = $attribute->getOptionIds();
     $options = $attribute->getOptionLabels();
     $placeholders['attribute_1_name'] = $attribute->getFrontendLabel();
     $placeholders['attribute_1_option_label_1'] = $options[0];
     $placeholders['attribute_1_option_label_2'] = $options[1];
     $this->_applyPlaceholders($this->_data, $placeholders);
     return $attribute->getFrontendLabel();
 }
开发者ID:,项目名称:,代码行数:20,代码来源:

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

示例10: 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,代码来源:

示例11: testCreateConfigurableProductWithNewAttribute

 /**
  * Creating configurable product with creating new category and new attribute (required fields only)
  *
  * @ZephyrId MAGETWO-13361
  * @return void
  */
 public function testCreateConfigurableProductWithNewAttribute()
 {
     //Data
     $product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $product->switchData('simple_with_new_category');
     $attribute = Factory::getFixtureFactory()->getMagentoCatalogProductAttribute();
     $attribute->switchData('new_attribute');
     $variations = Factory::getFixtureFactory()->getMagentoConfigurableProductConfigurableProduct();
     $variations->switchData('product_variations');
     $variations->provideNewAttributeData($attribute);
     //Steps
     $this->fillSimpleProductWithNewCategory($product);
     $this->addNewAttribute($attribute);
     $this->fillProductVariationsAndSave($variations);
     //Verifying
     $this->assertProductSaved();
     $this->assertOnGrid($product);
     $this->assertOnFrontend($product, $variations);
 }
开发者ID:,项目名称:,代码行数:25,代码来源:

示例12: testCreateProductAdvancedInventory

 /**
  * Create simple product with settings in advanced inventory tab
  *
  * @ZephyrId MAGETWO-12914
  * @return void
  */
 public function testCreateProductAdvancedInventory()
 {
     $product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $product->switchData('simple_advanced_inventory');
     //Data
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $productForm = $createProductPage->getProductForm();
     //Steps
     $createProductPage->open(['type' => 'simple', 'set' => 4]);
     $productForm->fill($product);
     $createProductPage->getFormPageActions()->save();
     $createProductPage->getMessagesBlock()->waitSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->waitSuccessMessage();
     //Verifying
     $this->assertOnGrid($product);
     $this->assertOnCategory($product);
 }
开发者ID:,项目名称:,代码行数:27,代码来源:

示例13: testUnassignOnProductPage

 /**
  * Unassigning products from the category on Product Information page
  *
  * @ZephyrId MAGETWO-12417
  * @return void
  */
 public function testUnassignOnProductPage()
 {
     //Data
     $simple = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $simple->switchData('simple');
     $simple->persist();
     //Steps
     $editProductPage = Factory::getPageFactory()->getCatalogProductEdit();
     $editProductPage->open(['id' => $simple->getProductId()]);
     $productForm = $editProductPage->getProductForm();
     $productForm->clearCategorySelect();
     $editProductPage->getFormPageActions()->save();
     //Verifying
     $editProductPage->getMessagesBlock()->waitSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->waitSuccessMessage();
     //Verifying
     $this->assertAbsenceOnCategory($simple);
 }
开发者ID:,项目名称:,代码行数:28,代码来源:

示例14: setUp

 protected function setUp()
 {
     $this->product = Factory::getFixtureFactory()->getMagentoDownloadableDownloadableProductLinksPurchasedSeparately();
     $this->product->switchData('downloadable');
     Factory::getApp()->magentoBackendLoginUser();
 }
开发者ID:,项目名称:,代码行数:6,代码来源:

示例15: getProduct

 /**
  * Create a new product
  *
  * @param string $productType
  * @throws \InvalidArgumentException
  * @return Product
  */
 public function getProduct($productType)
 {
     if (!isset($this->products[$productType])) {
         switch ($productType) {
             case 'simple':
                 $product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
                 $product->switchData($productType . '_required');
                 break;
             case 'virtual':
                 $product = Factory::getFixtureFactory()->getMagentoCatalogVirtualProduct();
                 $product->switchData($productType . '_required');
                 break;
             case 'downloadable':
                 $product = Factory::getFixtureFactory()->getMagentoDownloadableDownloadableProductLinksNotPurchasedSeparately();
                 break;
             case 'configurable':
                 $product = Factory::getFixtureFactory()->getMagentoConfigurableProductConfigurableProduct();
                 break;
             default:
                 throw new \InvalidArgumentException("Product of type '{$productType}' cannot be added to grouped product.");
         }
         $product->persist();
         $this->products[$productType] = $product;
     }
     return $this->products[$productType];
 }
开发者ID:,项目名称:,代码行数:33,代码来源:


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