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


PHP Factory::getApp方法代码示例

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


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

示例1: testUrlRewriteCreation

 /**
  * Adding temporary redirect for product
  *
  * @return void
  * @ZephyrId MAGETWO-12409
  */
 public function testUrlRewriteCreation()
 {
     /** @var UrlRewriteProduct $urlRewriteProduct */
     $urlRewriteProduct = Factory::getFixtureFactory()->getMagentoUrlRewriteUrlRewriteProduct();
     $urlRewriteProduct->switchData('product_with_temporary_redirect');
     //Pages & Blocks
     $urlRewriteGridPage = Factory::getPageFactory()->getAdminUrlrewriteIndex();
     $pageActionsBlock = $urlRewriteGridPage->getPageActionsBlock();
     $urlRewriteEditPage = Factory::getPageFactory()->getAdminUrlrewriteEdit();
     $categoryTreeBlock = $urlRewriteEditPage->getTreeBlock();
     $productGridBlock = $urlRewriteEditPage->getProductGridBlock();
     $typeSelectorBlock = $urlRewriteEditPage->getUrlRewriteTypeSelectorBlock();
     $urlRewriteInfoForm = $urlRewriteEditPage->getFormBlock();
     //Steps
     Factory::getApp()->magentoBackendLoginUser();
     $urlRewriteGridPage->open();
     $pageActionsBlock->addNew();
     $typeSelectorBlock->selectType($urlRewriteProduct->getUrlRewriteType());
     $productGridBlock->searchAndSelect(['sku' => $urlRewriteProduct->getProductSku()]);
     $categoryTreeBlock->selectCategory($urlRewriteProduct->getCategoryName());
     $urlRewriteInfoForm->fill($urlRewriteProduct);
     $urlRewriteEditPage->getPageMainActions()->save();
     $this->assertContains('The URL Rewrite has been saved.', $urlRewriteGridPage->getMessagesBlock()->getSuccessMessages());
     $this->assertUrlRedirect($_ENV['app_frontend_url'] . $urlRewriteProduct->getRewrittenRequestPath(), $_ENV['app_frontend_url'] . $urlRewriteProduct->getOriginalRequestPath());
 }
开发者ID:aiesh,项目名称:magento2,代码行数:31,代码来源:ProductTest.php

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

示例3: testWithRequiredFields

 /**
  * Creating Category from Category page with required fields only
  *
  * @ZephyrId MAGETWO-12513
  */
 public function testWithRequiredFields()
 {
     //Data
     /** @var Category $category */
     $category = Factory::getFixtureFactory()->getMagentoCatalogCategory();
     //Pages & Blocks
     $catalogCategoryPage = Factory::getPageFactory()->getCatalogCategory();
     $treeBlock = $catalogCategoryPage->getTreeBlock();
     $catalogCategoryEditPage = Factory::getPageFactory()->getCatalogCategoryEditId();
     $treeBlockEdit = $catalogCategoryEditPage->getTreeBlock();
     $formBlock = $catalogCategoryEditPage->getFormBlock();
     $actionsBlock = $catalogCategoryEditPage->getPageActionsBlock();
     $messagesBlock = $catalogCategoryEditPage->getMessagesBlock();
     //Steps
     Factory::getApp()->magentoBackendLoginUser();
     $catalogCategoryPage->open();
     $treeBlock->selectCategory($category);
     $treeBlockEdit->addSubcategory();
     $formBlock->fill($category);
     $actionsBlock->save();
     //Verifying
     $messagesBlock->assertSuccessMessage();
     //Flush cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->assertSuccessMessage();
     //Verifying
     $this->assertCategoryOnFrontend($category);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:35,代码来源:CreateTest.php

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

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

示例6: testAddReviewByGuest

 /**
  * Adding product review from not logged customer prospective
  *
  * @ZephyrId MAGETWO-12403
  */
 public function testAddReviewByGuest()
 {
     //Preconditions
     $productFixture = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $productFixture->switchData('simple_required');
     $productFixture->persist();
     $reviewFixture = Factory::getFixtureFactory()->getMagentoReviewReview();
     //Pages & Blocks
     $homePage = Factory::getPageFactory()->getCmsIndexIndex();
     $productPage = Factory::getPageFactory()->getCatalogProductView();
     $backendReviewIndex = Factory::getPageFactory()->getReviewProductIndex();
     $backendReviewEdit = Factory::getPageFactory()->getReviewProductEdit();
     $reviewsSummaryBlock = $productPage->getReviewSummaryBlock();
     $reviewsBlock = $productPage->getCustomerReviewBlock();
     $reviewForm = $productPage->getReviewFormBlock();
     $reviewGrid = $backendReviewIndex->getReviewGrid();
     $reviewBackendForm = $backendReviewEdit->getReviewForm();
     //Steps & verifying
     $homePage->open();
     $productPage->init($productFixture);
     $productPage->open();
     $this->verifyNoReviewOnPage($reviewsSummaryBlock);
     $reviewsSummaryBlock->getAddReviewLink()->click();
     $this->assertFalse($reviewsBlock->getFirstReview()->isVisible(), 'No reviews below the form required');
     $reviewForm->fill($reviewFixture);
     $reviewForm->submit();
     $submitReviewMessage = 'Your review has been accepted for moderation.';
     $this->assertContains($submitReviewMessage, $productPage->getMessagesBlock()->getSuccessMessages(), sprintf('Message "%s" is not appear', $submitReviewMessage));
     $this->verifyNoReviewOnPage($productPage->getReviewSummaryBlock());
     Factory::getApp()->magentoBackendLoginUser();
     $backendReviewIndex->open();
     $reviewGrid->searchAndOpen(array('title' => $reviewFixture->getTitle()));
     $this->assertEquals('Guest', $reviewBackendForm->getPostedBy(), 'Review is not posted by Guest');
     $this->assertEquals('Pending', $reviewBackendForm->getStatus(), 'Review is not in Pending status');
     $this->assertTrue($this->verifyReviewBackendForm($reviewFixture, $reviewBackendForm), 'Review data is not corresponds to submitted one');
     $reviewBackendForm->setApproveReview();
     $backendReviewEdit->getPageActions()->save();
     $this->assertContains('You saved the review.', $backendReviewIndex->getMessagesBlock()->getSuccessMessages(), 'Review is not saved');
     $this->flushCacheStorageWithAssert();
     $productPage->open();
     $reviewsSummaryBlock = $productPage->getReviewSummaryBlock();
     $this->assertTrue($reviewsSummaryBlock->getAddReviewLink()->isVisible(), 'Add review link is not visible');
     $this->assertTrue($reviewsSummaryBlock->getViewReviewLink()->isVisible(), 'View review link is not visible');
     $this->assertContains('1', $reviewsSummaryBlock->getViewReviewLink()->getText(), 'There is more than 1 approved review');
     $reviewForm = $productPage->getReviewFormBlock();
     $reviewsBlock = $productPage->getCustomerReviewBlock();
     $reviewsSummaryBlock->getViewReviewLink()->click();
     $this->assertContains(sprintf('You\'re reviewing:%s', $productFixture->getName()), $reviewForm->getLegend()->getText());
     $this->verifyReview($reviewsBlock, $reviewFixture);
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:55,代码来源:ReviewTest.php

示例7: testAssignProducts

 /**
  * Creating a subcategory and assign products to the category
  *
  * @ZephyrId MAGETWO-16351
  */
 public function testAssignProducts()
 {
     //Data
     $simple = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
     $simple->switchData('simple_required');
     $simple->persist();
     $configurable = Factory::getFixtureFactory()->getMagentoConfigurableProductConfigurableProduct();
     $configurable->switchData('configurable_required');
     $configurable->persist();
     $bundle = Factory::getFixtureFactory()->getMagentoBundleBundleFixed();
     $bundle->switchData('bundle_fixed_required');
     $bundle->persist();
     $category = Factory::getFixtureFactory()->getMagentoCatalogCatalogCategory();
     $category->persist();
     //Pages & Blocks
     $catalogCategoryPage = Factory::getPageFactory()->getCatalogCategory();
     $catalogCategoryEditPage = Factory::getPageFactory()->getCatalogCategoryEditId();
     $treeBlock = $catalogCategoryPage->getTreeBlock();
     $formBlock = $catalogCategoryPage->getFormBlock();
     $messagesBlock = $catalogCategoryPage->getMessagesBlock();
     $actionsBlock = $catalogCategoryEditPage->getPageActionsBlock();
     //Steps
     Factory::getApp()->magentoBackendLoginUser();
     $catalogCategoryPage->open();
     $treeBlock->selectCategory($category);
     $formBlock->openTab('category_products');
     $categoryProductsGrid = $formBlock->getCategoryProductsGrid();
     $products = [$simple, $configurable, $bundle];
     /** @var Product $product */
     foreach ($products as $product) {
         $categoryProductsGrid->searchAndSelect(['sku' => $product->getProductSku()]);
     }
     $actionsBlock->save();
     $messagesBlock->assertSuccessMessage();
     //Clean Cache
     $cachePage = Factory::getPageFactory()->getAdminCache();
     $cachePage->open();
     $cachePage->getActionsBlock()->flushMagentoCache();
     $cachePage->getMessagesBlock()->assertSuccessMessage();
     //Indexing
     $indexPage = Factory::getPageFactory()->getAdminProcessList();
     $indexPage->open();
     $indexPage->getActionsBlock()->reindexAll();
     $indexPage->getMessagesBlock()->assertSuccessMessage();
     //Verifying
     $this->assertProductsOnCategory($category, $products);
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:52,代码来源:AssignProductTest.php

示例8: testCreateTaxRule

 /**
  * Create Tax Rule with new and existing Tax Rate, Customer Tax Class, Product Tax Class
  *
  * @ZephyrId MAGETWO-12438
  */
 public function testCreateTaxRule()
 {
     //Data
     $objectManager = Factory::getObjectManager();
     $fixture = $objectManager->create('\\Magento\\Tax\\Test\\Fixture\\TaxRule', ['dataSet' => 'us_ca_ny_rule']);
     //Pages
     $taxGridPage = Factory::getPageFactory()->getTaxRuleIndex();
     $newTaxRulePage = Factory::getPageFactory()->getTaxRuleNew();
     //Steps
     Factory::getApp()->magentoBackendLoginUser();
     $taxGridPage->open();
     $taxGridPage->getGridPageActions()->addNew();
     $newTaxRulePage->getTaxRuleForm()->fill($fixture);
     $newTaxRulePage->getFormPageActions()->saveAndContinue();
     //Verifying
     $newTaxRulePage->getMessagesBlock()->assertSuccessMessage();
     $this->_assertOnGrid($fixture);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:23,代码来源:TaxRuleTest.php

示例9: test

 /**
  * Adding permanent redirect for category
  *
  * @param UrlRewriteCategory $urlRewriteCategory
  * @return void
  * @ZephyrId MAGETWO-12407
  */
 public function test(\Magento\UrlRewrite\Test\Fixture\UrlRewriteCategory $urlRewriteCategory)
 {
     $urlRewriteCategory->switchData('category_with_permanent_redirect');
     //Pages & Blocks
     $urlRewriteIndexPage = Factory::getPageFactory()->getAdminUrlrewriteIndex();
     $pageActionsBlock = $urlRewriteIndexPage->getPageActionsBlock();
     $urlRewriteEditPage = Factory::getPageFactory()->getAdminUrlrewriteEdit();
     $categoryTreeBlock = $urlRewriteEditPage->getTreeBlock();
     $urlRewriteInfoForm = $urlRewriteEditPage->getFormBlock();
     //Steps
     Factory::getApp()->magentoBackendLoginUser();
     $urlRewriteIndexPage->open();
     $pageActionsBlock->addNew();
     $categoryTreeBlock->selectCategory($urlRewriteCategory->getCategoryName());
     $urlRewriteInfoForm->fill($urlRewriteCategory);
     $urlRewriteEditPage->getPageMainActions()->save();
     $this->assertContains('The URL Rewrite has been saved.', $urlRewriteIndexPage->getMessagesBlock()->getSuccessMessages());
     $this->assertUrlRedirect($_ENV['app_frontend_url'] . $urlRewriteCategory->getRewrittenRequestPath(), $_ENV['app_frontend_url'] . $urlRewriteCategory->getOriginalRequestPath());
 }
开发者ID:aiesh,项目名称:magento2,代码行数:26,代码来源:CategoryTest.php

示例10: setUp

 /**
  * Login into backend area before test
  */
 protected function setUp()
 {
     Factory::getApp()->magentoBackendLoginUser();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:7,代码来源:BackendCustomerCreateTest.php

示例11: persist

 /**
  * Create category
  *
  * @return Category
  */
 public function persist()
 {
     $id = Factory::getApp()->magentoCatalogCreateCategory($this);
     $this->_data['fields']['category_id']['value'] = $id;
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:11,代码来源:Category.php

示例12: persist

 /**
  * Create user
  */
 public function persist()
 {
     Factory::getApp()->magentoUserCreateUser($this);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:7,代码来源:AdminUser.php

示例13: persist

 /**
  * Create Store
  *
  * @return Store
  */
 public function persist()
 {
     return Factory::getApp()->magentoStoreCreateStoreGroup($this);
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:9,代码来源:StoreGroup.php

示例14: persist

 /**
  * Create product
  *
  * @return $this|ConfigurableProduct
  */
 public function persist()
 {
     $id = Factory::getApp()->magentoConfigurableProductCreateConfigurable($this);
     $this->_data['id']['value'] = $id;
     return $this;
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:11,代码来源:ConfigurableProduct.php

示例15: persist

 /**
  * Create customer via backend
  */
 public function persist()
 {
     Factory::getApp()->magentoCustomerCreateCustomerBackend($this);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:7,代码来源:CustomerBackend.php


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