本文整理汇总了PHP中Mtf\Factory\Factory::getFixtureFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getFixtureFactory方法的具体用法?PHP Factory::getFixtureFactory怎么用?PHP Factory::getFixtureFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mtf\Factory\Factory
的用法示例。
在下文中一共展示了Factory::getFixtureFactory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'];
}
示例2: 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);
}
示例3: testCreateConfigurableProduct
/**
* Creating configurable product and assigning it to category
*
* @ZephyrId MAGETWO-12620
* @return void
*/
public function testCreateConfigurableProduct()
{
//Data
$product = Factory::getFixtureFactory()->getMagentoCatalogConfigurableProduct();
$product->switchData('configurable');
//Page & Blocks
$manageProductsGrid = Factory::getPageFactory()->getCatalogProductIndex();
$createProductPage = Factory::getPageFactory()->getCatalogProductNew();
//Steps
$manageProductsGrid->open();
$manageProductsGrid->getProductBlock()->addProduct('configurable');
$productForm = $createProductPage->getProductForm();
$productForm->fill($product);
$createProductPage->getFormAction()->saveProduct($createProductPage, $product);
//Verifying
$createProductPage->getMessagesBlock()->assertSuccessMessage();
//Flush cache
$cachePage = Factory::getPageFactory()->getAdminCache();
$cachePage->open();
$cachePage->getActionsBlock()->flushMagentoCache();
$cachePage->getMessagesBlock()->assertSuccessMessage();
//Verifying
$this->assertOnGrid($product);
$this->assertOnFrontend($product);
}
示例4: 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());
}
示例5: testEditProduct
/**
* Edit simple product
*
* @ZephyrId MAGETWO-12428
* @return void
*/
public function testEditProduct()
{
$product = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
$product->switchData('simple');
$product->persist();
$editProduct = Factory::getFixtureFactory()->getMagentoCatalogSimpleProduct();
$editProduct->switchData('simple_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->getProductSku(), 'type' => 'Simple Product']);
$productForm->fill($editProduct);
$editProductPage->getFormPageActions()->save();
//Verifying
$editProductPage->getMessagesBlock()->assertSuccessMessage();
// Flush cache
$cachePage->open();
$cachePage->getActionsBlock()->flushMagentoCache();
//Verifying
$this->assertOnGrid($editProduct);
$this->assertOnCategoryPage($editProduct, $product->getCategoryName());
$this->assertOnProductPage($product, $editProduct);
}
示例6: 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->getForm();
$cachePage = Factory::getPageFactory()->getAdminCache();
$productGridPage->open();
$gridBlock->searchAndOpen(array('sku' => $product->getProductSku(), 'type' => 'Bundle Product'));
$productForm->fillProduct($editProduct);
$editProductPage->getFormAction()->save();
//Verifying
$editProductPage->getMessagesBlock()->assertSuccessMessage();
// Flush cache
$cachePage->open();
$cachePage->getActionsBlock()->flushMagentoCache();
//Verifying
$this->assertOnGrid($editProduct);
$this->assertOnCategory($editProduct, $product->getCategoryName());
}
示例7: 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());
}
示例8: testCreateNewLocalizedStoreView
/**
* @ZephyrId MAGETWO-12405
*/
public function testCreateNewLocalizedStoreView()
{
$storeFixture = Factory::getFixtureFactory()->getMagentoStoreStore();
$storeListPage = Factory::getPageFactory()->getAdminSystemStore();
$storeListPage->open();
$storeListPage->getPageActionsBlock()->addStoreView();
$newStorePage = Factory::getPageFactory()->getAdminSystemStoreNewStore();
$newStorePage->getFormBlock()->fill($storeFixture);
$newStorePage->getPageActionsBlock()->clickSave();
$storeListPage->getMessagesBlock()->assertSuccessMessage();
$this->assertContains('The store view has been saved', $storeListPage->getMessagesBlock()->getSuccessMessages());
$this->assertTrue($storeListPage->getGridBlock()->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->getData('fields/group/value'), $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'));
}
示例9: 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;
}
示例10: 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);
}
示例11: 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->addNewCategory($product);
$productForm->fill($product);
$createProductPage->getFormAction()->save();
//Verifying
$this->assertSuccessMessage("You saved the product.");
//Flush cache
$cachePage = Factory::getPageFactory()->getAdminCache();
$cachePage->open();
$cachePage->getActionsBlock()->flushMagentoCache();
$cachePage->getMessagesBlock()->assertSuccessMessage();
//Verifying
$this->assertProductOnFrontend($product);
}
示例12: 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->getForm();
//Steps
$manageProductsGrid->open();
$manageProductsGrid->getProductBlock()->addProduct('bundle');
$productForm->fillProduct($bundle);
$createProductPage->getFormAction()->save();
//Verification
$createProductPage->getMessagesBlock()->assertSuccessMessage();
// Flush cache
$cachePage = Factory::getPageFactory()->getAdminCache();
$cachePage->open();
$cachePage->getActionsBlock()->flushMagentoCache();
$cachePage->getMessagesBlock()->assertSuccessMessage();
//Verification
$this->assertOnGrid($bundle);
$this->assertOnCategory($bundle);
}
示例13: __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();
}
示例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();
}
示例15: _categoryProvider
/**
* Create category needed for placeholders in data and call method for placeholder
*
* @param string $placeholder
* @return string
*/
protected function _categoryProvider($placeholder)
{
list($key, $method) = explode('::', $placeholder);
if (!isset($this->_categories[$key])) {
$category = Factory::getFixtureFactory()->getMagentoCatalogCategory();
$category->switchData($key);
$category->persist();
$this->_categories[$key] = $category;
}
return is_callable(array($this->_categories[$key], $method)) ? $this->_categories[$key]->{$method}() : '';
}