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

PHP Factory\Factory类代码示例

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

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



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

示例1: 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()->assertSuccessMessage();
     $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()->assertSuccessMessage();
     $configPage = Factory::getPageFactory()->getAdminSystemConfig();
     $configPage->open();
     $configPage->getPageActions()->selectStore(['Main Website', $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()->assertSuccessMessage();
     $homePage = Factory::getPageFactory()->getCmsIndexIndex();
     $homePage->open();
     $homePage->getStoreSwitcherBlock()->selectStoreView($storeFixture->getName());
     $this->assertTrue($homePage->getSearchBlock()->isPlaceholderContains('Den gesamten Shop durchsuchen'));
 }
开发者ID:aiesh,项目名称:magento2,代码行数:33,代码来源:StoreTest.php


示例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:aiesh,项目名称:magento2,代码行数:10,代码来源:Role.php


示例3: testCreateCustomer

 /**
  * Create Customer account on frontend
  *
  * @ZephyrId MAGETWO-12394
  */
 public function testCreateCustomer()
 {
     //Data
     $customer = Factory::getFixtureFactory()->getMagentoCustomerCustomer();
     $customer->switchData('customer_US_1');
     $customerAddress = $customer->getAddressData();
     //Page
     $homePage = Factory::getPageFactory()->getCmsIndexIndex();
     $createPage = Factory::getPageFactory()->getCustomerAccountCreate();
     $accountIndexPage = Factory::getPageFactory()->getCustomerAccountIndex();
     $addressEditPage = Factory::getPageFactory()->getCustomerAddressEdit();
     //Step 1 Create Account
     $homePage->open();
     $topLinks = $homePage->getLinksBlock();
     $topLinks->openLink('Register');
     $createPage->getRegisterForm()->registerCustomer($customer);
     //Verifying
     $this->assertContains('Thank you for registering', $accountIndexPage->getMessages()->getSuccessMessages());
     //Check that customer redirected to Dashboard after registration
     $this->assertContains('My Dashboard', $accountIndexPage->getTitleBlock()->getTitle());
     //Step 2 Set Billing Address
     $accountIndexPage->getDashboardAddress()->editBillingAddress();
     $addressEditPage->getEditForm()->editCustomerAddress($customerAddress);
     //Verifying
     $accountIndexPage = Factory::getPageFactory()->getCustomerAccountIndex();
     $this->assertContains('The address has been saved', $accountIndexPage->getMessages()->getSuccessMessages());
     //Verify customer address against previously entered data
     $accountIndexPage->open();
     $accountIndexPage->getDashboardAddress()->editBillingAddress();
     $addressEditPage = Factory::getPageFactory()->getCustomerAddressEdit();
     $this->verifyCustomerAddress($customerAddress, $addressEditPage->getEditForm());
 }
开发者ID:aiesh,项目名称:magento2,代码行数:37,代码来源:CreateOnFrontendTest.php


示例4: _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:aiesh,项目名称:magento2,代码行数:12,代码来源:BundleFixed.php


示例5: _initData

 /**
  * Initialize fixture data
  */
 protected function _initData()
 {
     $this->_data['checkout'] = array('prices' => array('price_from' => 10, 'price_to' => 15), 'selection' => array('bundle_item_0' => 'assigned_product_0'));
     parent::_initData();
     $this->_data['fields'] = array_merge_recursive($this->_data['fields'], array('sku_type' => array('value' => 'Dynamic', 'input_value' => '0', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'), 'price_type' => array('value' => 'Dynamic', 'input_value' => '0', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'), 'weight_type' => array('value' => 'Dynamic', 'input_value' => '0', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'), 'product_website_1' => array('value' => 'Yes', 'input_value' => array(1), 'group' => static::GROUP_PRODUCT_WEBSITE, 'input' => 'checkbox', 'input_name' => 'website_ids'), 'shipment_type' => array('value' => 'Separately', 'input_value' => '1', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'), 'bundle_selections' => array('value' => array('bundle_options' => array('bundle_item_0' => array('title' => 'Drop-down Option', 'type' => 'Drop-down', 'required' => 'Yes', 'assigned_products' => array('assigned_product_0' => array('search_data' => array('name' => '%item1_simple1::getName%'), 'data' => array('selection_qty' => 1, 'product_id' => '%item1_simple1::getProductId%')), 'assigned_product_1' => array('search_data' => array('name' => '%item1_virtual2::getName%'), 'data' => array('selection_qty' => 1, 'product_id' => '%item1_virtual2::getProductId%')))))), 'group' => static::GROUP)));
     $this->_repository = Factory::getRepositoryFactory()->getMagentoBundleBundle($this->_dataConfig, $this->_data);
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:10,代码来源:BundleDynamic.php


示例6: 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()->getMagentoCatalogConfigurableProduct();
     $configurable->switchData('configurable');
     $configurable->persist();
     $productSku = $configurable->getProductSku();
     //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->getFormAction()->save();
     //Verifying
     $createProductPage->getMessagesBlock()->assertSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     //Verifying
     $this->assertOnGrid($editProduct);
     $this->assertOnFrontend($editProduct);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:38,代码来源:EditConfigurableTest.php


示例7: __construct

 /**
  * @param Config $configuration
  * @param array $placeholders
  */
 public function __construct(Config $configuration, array $placeholders = array())
 {
     parent::__construct($configuration, $placeholders);
     $this->_placeholders['rewritten_category_request_path'] = array($this, 'getRewrittenRequestPath');
     $this->_repository = Factory::getRepositoryFactory()->getMagentoUrlRewriteUrlRewriteCategory($this->_dataConfig, $this->_data);
     $this->category = Factory::getFixtureFactory()->getMagentoCatalogCategory();
     $this->category->persist();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:UrlRewriteCategory.php


示例8: _initData

 /**
  * {inheritdoc}
  */
 protected function _initData()
 {
     parent::_initData();
     $this->_dataConfig = array('constraint' => 'Success', 'grid_filter' => array('name'), 'create_url_params' => array('type' => 'simple', 'set' => static::DEFAULT_ATTRIBUTE_SET_ID), 'input_prefix' => 'product');
     $data = $this->_getPreparedData();
     $this->_data['fields'] = array_merge($this->_data['fields'], $data);
     $this->_repository = Factory::getRepositoryFactory()->getMagentoCatalogSimpleProduct($this->_dataConfig, $this->_data);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:11,代码来源:SimpleProduct.php


示例9: _initData

 /**
  * Init Data
  */
 protected function _initData()
 {
     $this->_dataConfig = array('assignType ' => $this->assignType);
     /** @var  $type Related|Upsell */
     $type = 'Magento\\Catalog\\Test\\Block\\Adminhtml\\Product\\Edit\\Tab\\' . ucfirst(strtolower($this->assignType));
     $this->_data = array('fields' => array($this->assignType . '_products' => array('value' => array('product_1' => array('sku' => '%' . $this->assignType . '_simple::getProductSku%', 'name' => '%' . $this->assignType . '_simple::getName%'), 'product_2' => array('sku' => '%' . $this->assignType . '_configurable::getProductSku%', 'name' => '%' . $this->assignType . '_configurable::getName%')), 'group' => $type::GROUP)));
     $this->_repository = Factory::getRepositoryFactory()->getMagentoCatalogAssignProducts($this->_dataConfig, $this->_data);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:11,代码来源:AssignProducts.php


示例10: _initData

 /**
  * {@inheritdoc}
  */
 protected function _initData()
 {
     parent::_initData();
     $this->_dataConfig = array('constraint' => 'Success', 'grid_filter' => array('name'), 'create_url_params' => array('type' => 'virtual', 'set' => static::DEFAULT_ATTRIBUTE_SET_ID), 'input_prefix' => 'product');
     $data = array('is_virtual' => array('value' => '', 'group' => null), 'price' => array('value' => 15, 'group' => static::GROUP_PRODUCT_DETAILS), 'tax_class_id' => array('value' => 'Taxable Goods', 'input_value' => '2', 'group' => static::GROUP_PRODUCT_DETAILS, 'input' => 'select'), 'qty' => array('value' => 1000, 'group' => static::GROUP_PRODUCT_DETAILS, 'input_name' => 'product[quantity_and_stock_status][qty]'), 'product_website_1' => array('value' => 'Yes', 'input_value' => 1, 'group' => static::GROUP_PRODUCT_WEBSITE, 'input' => 'checkbox', 'input_name' => 'product[website_ids][]'), 'inventory_manage_stock' => array('value' => 'No', 'input_value' => '0', 'group' => static::GROUP_PRODUCT_INVENTORY, 'input' => 'select', 'input_name' => 'product[stock_data][manage_stock]'));
     $this->_data['fields'] = array_merge($this->_data['fields'], $data);
     $this->_repository = Factory::getRepositoryFactory()->getMagentoCatalogVirtualProduct($this->_dataConfig, $this->_data);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:11,代码来源:VirtualProduct.php


示例11: assertCategoryOnFrontend

 /**
  * Verify category on the frontend
  *
  * @param Category $category
  */
 protected function assertCategoryOnFrontend(Category $category)
 {
     //Open created category on frontend
     $frontendHomePage = Factory::getPageFactory()->getCmsIndexIndex();
     $frontendHomePage->open();
     $navigationMenu = $frontendHomePage->getTopmenu();
     $navigationMenu->selectCategoryByName($category->getCategoryName());
     $this->assertEquals($category->getCategoryName(), $frontendHomePage->getTitleBlock()->getTitle());
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:CreateTest.php


示例12: 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()->assertSuccessMessage();
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:15,代码来源:CreateProduct.php


示例13: test

 /**
  * Test admin login to backend
  *
  * @param SuperAdmin $fixture
  */
 public function test(SuperAdmin $fixture)
 {
     //Page
     $loginPage = Factory::getPageFactory()->getAdminAuthLogin();
     //Steps
     $loginPage->open();
     $loginPage->getLoginBlock()->fill($fixture);
     $loginPage->getLoginBlock()->submit();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:UserTest.php


示例14: __construct

 /**
  * @param Config $configuration
  * @param array $placeholders
  */
 public function __construct(Config $configuration, $placeholders = array())
 {
     parent::__construct($configuration, $placeholders);
     $this->_placeholders['rewritten_product_request_path'] = array($this, 'getRewrittenRequestPath');
     $this->_repository = Factory::getRepositoryFactory()->getMagentoUrlRewriteUrlRewriteProduct($this->_dataConfig, $this->_data);
     $this->product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $this->product->switchData('simple');
     $this->product->persist();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:13,代码来源:UrlRewriteProduct.php


示例15: persist

 /**
  * Create product
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed|string
  */
 public function persist(FixtureInterface $fixture = null)
 {
     Factory::getApp()->magentoBackendLoginUser();
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $createProductPage->init($fixture);
     $createProductPage->open();
     $productForm = $createProductPage->getProductForm();
     $productForm->fill($fixture);
     $createProductPage->getFormAction()->save();
     $createProductPage->getMessagesBlock()->assertSuccessMessage();
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:17,代码来源:Ui.php


示例16: fillBundleOptions

 /**
  * Fill bundle options
  *
  * @param array $bundleOptions
  * @return void
  */
 public function fillBundleOptions($bundleOptions)
 {
     $index = 1;
     foreach ($bundleOptions as $option) {
         /** @var $optionBlock \Magento\Bundle\Test\Block\Catalog\Product\View\Type\Option\Radio|
          * \Magento\Bundle\Test\Block\Catalog\Product\View\Type\Option\Select */
         $getClass = 'getMagentoBundleCatalogProductViewTypeOption' . ucfirst($option['type']);
         $optionBlock = Factory::getBlockFactory()->{$getClass}($this->_rootElement->find('.field.option.required:nth-of-type(' . $index++ . ')'));
         $optionBlock->fillOption($option);
     }
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:17,代码来源:Bundle.php


示例17: 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:buskamuza,项目名称:magento2-skeleton,代码行数:18,代码来源:UnassignCategoryTest.php


示例18: fillFormTab

 /**
  * Select cross-sells products
  *
  * @param array $products
  * @param Element|null $context
  * @return $this
  */
 public function fillFormTab(array $products, Element $context = null)
 {
     if (!isset($products['crosssell_products'])) {
         return $this;
     }
     $element = $context ?: $this->_rootElement;
     $crossSellBlock = Factory::getBlockFactory()->getMagentoCatalogAdminhtmlProductEditTabCrosssellGrid($element->find('#cross_sell_product_grid'));
     foreach ($products['crosssell_products']['value'] as $product) {
         $crossSellBlock->searchAndSelect($product);
     }
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:19,代码来源:Crosssell.php


示例19: 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:aiesh,项目名称:magento2,代码行数:19,代码来源:CreateAddress.php


示例20: _initData

 /**
  * Init Data
  */
 protected function _initData()
 {
     $this->_dataConfig = array('assignType ' => $this->assignType);
     /** @var  $type Related|Upsell */
     $type = 'Magento\\Catalog\\Test\\Block\\Adminhtml\\Product\\Edit\\Tab\\' . ucfirst(strtolower($this->assignType));
     $productsArray = array();
     foreach ($this->_products as $key => $product) {
         /** @var $product \Magento\Catalog\Test\Fixture\Product */
         $productsArray['product_' . $key] = array('sku' => $product->getProductSku(), 'name' => $product->getName());
     }
     $this->_data['fields'][$this->assignType . '_products']['value'] = $productsArray;
     $this->_data['fields'][$this->assignType . '_products']['group'] = $type::GROUP;
     $this->_repository = Factory::getRepositoryFactory()->getMagentoCatalogAssignProducts($this->_dataConfig, $this->_data);
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:17,代码来源:CrosssellProducts.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Fixture\FixtureInterface类代码示例发布时间:2022-05-23
下一篇:
PHP Api\MozuUrl类代码示例发布时间: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