/**
  * 1. Creating product simple with custom tax product class
  * 2. Log In as customer
  * 3. Add product to shopping cart
  * 4. Estimate Shipping and Tax
  * 5. Implementation assert
  *
  * @param FixtureFactory $fixtureFactory
  * @param TaxRule $taxRule
  * @param CustomerAccountLogin $customerAccountLogin
  * @param CustomerAccountLogout $customerAccountLogout
  * @param CustomerInjectable $customer
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param AddressInjectable $address
  * @param array $shipping
  * @param TaxRule $initialTaxRule
  * @return void
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function processAssert(FixtureFactory $fixtureFactory, TaxRule $taxRule, CustomerAccountLogin $customerAccountLogin, CustomerAccountLogout $customerAccountLogout, CustomerInjectable $customer, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, AddressInjectable $address, array $shipping, TaxRule $initialTaxRule = null)
 {
     $this->initialTaxRule = $initialTaxRule;
     $this->taxRule = $taxRule;
     $this->checkoutCart = $checkoutCart;
     $this->shipping = $shipping;
     if ($this->initialTaxRule !== null) {
         $this->taxRuleCode = $this->taxRule->hasData('code') ? $this->taxRule->getCode() : $this->initialTaxRule->getCode();
     } else {
         $this->taxRuleCode = $this->taxRule->getCode();
     }
     // Creating simple product with custom tax class
     /** @var \Magento\Tax\Test\Fixture\TaxClass $taxProductClass */
     $taxProductClass = $taxRule->getDataFieldConfig('tax_product_class')['source']->getFixture()[0];
     $this->productSimple = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => '100_dollar_product_for_tax_rule', 'data' => ['tax_class_id' => ['tax_product_class' => $taxProductClass]]]);
     $this->productSimple->persist();
     // Customer login
     $customerAccountLogout->open();
     $customerAccountLogin->open();
     $customerAccountLogin->getLoginBlock()->login($customer);
     // Clearing shopping cart and adding product to shopping cart
     $checkoutCart->open()->getCartBlock()->clearShoppingCart();
     $catalogProductView->init($this->productSimple);
     $catalogProductView->open();
     $catalogProductView->getViewBlock()->clickAddToCart();
     // Estimate Shipping and Tax
     $checkoutCart->getShippingBlock()->openEstimateShippingAndTax();
     $checkoutCart->getShippingBlock()->fill($address);
     $checkoutCart->getShippingBlock()->clickGetQuote();
     $checkoutCart->getShippingBlock()->selectShippingMethod($shipping);
     $this->assert();
 }
 /**
  * Injection data
  *
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductEdit $editProductPage
  * @param CatalogCategory $category
  * @param FixtureFactory $fixtureFactory
  * @return array
  */
 public function __inject(CatalogProductIndex $productGrid, CatalogProductEdit $editProductPage, CatalogCategory $category, FixtureFactory $fixtureFactory)
 {
     $this->product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default', 'data' => ['category_ids' => ['category' => $category]]]);
     $this->product->persist();
     $this->productGrid = $productGrid;
     $this->editProductPage = $editProductPage;
 }
Exemplo n.º 3
0
 /**
  * 1. Creating product simple with custom tax product class
  * 2. Log In as customer
  * 3. Add product to shopping cart
  * 4. Estimate Shipping and Tax
  * 5. Implementation assert
  *
  * @param FixtureFactory $fixtureFactory
  * @param TaxRule $taxRule
  * @param Customer $customer
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param Address $address
  * @param array $shipping
  * @param BrowserInterface $browser
  * @param TaxRule $initialTaxRule
  * @return void
  */
 public function processAssert(FixtureFactory $fixtureFactory, TaxRule $taxRule, Customer $customer, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, Address $address, array $shipping, BrowserInterface $browser, TaxRule $initialTaxRule = null)
 {
     $this->initialTaxRule = $initialTaxRule;
     $this->taxRule = $taxRule;
     $this->checkoutCart = $checkoutCart;
     $this->shipping = $shipping;
     if ($this->initialTaxRule !== null) {
         $this->taxRuleCode = $this->taxRule->hasData('code') ? $this->taxRule->getCode() : $this->initialTaxRule->getCode();
     } else {
         $this->taxRuleCode = $this->taxRule->getCode();
     }
     // Creating simple product with custom tax class
     /** @var \Magento\Tax\Test\Fixture\TaxClass $taxProductClass */
     $taxProductClass = $taxRule->getDataFieldConfig('tax_product_class')['source']->getFixture()[0];
     $this->productSimple = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_100_dollar_for_tax_rule', 'data' => ['tax_class_id' => ['tax_product_class' => $taxProductClass]]]);
     $this->productSimple->persist();
     // Customer login
     $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     // Clearing shopping cart and adding product to shopping cart
     $checkoutCart->open()->getCartBlock()->clearShoppingCart();
     $browser->open($_ENV['app_frontend_url'] . $this->productSimple->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickAddToCart();
     $catalogProductView->getMessagesBlock()->waitSuccessMessage();
     // Estimate Shipping and Tax
     $checkoutCart->open();
     $checkoutCart->getShippingBlock()->openEstimateShippingAndTax();
     $checkoutCart->getShippingBlock()->fill($address);
     $checkoutCart->getShippingBlock()->clickGetQuote();
     $checkoutCart->getShippingBlock()->selectShippingMethod($shipping);
     $this->assert();
 }
Exemplo n.º 4
0
 /**
  * Create currency rate test.
  *
  * @param CurrencyRate $currencyRate
  * @param CatalogProductSimple $product
  * @param $config
  * @return void
  */
 public function test(CurrencyRate $currencyRate, CatalogProductSimple $product, ConfigData $config)
 {
     // Preconditions:
     $product->persist();
     $config->persist();
     // Steps:
     $this->currencyIndexPage->open();
     $this->currencyIndexPage->getCurrencyRateForm()->fill($currencyRate);
     $this->currencyIndexPage->getFormPageActions()->save();
 }
 /**
  * Apply several sales rules.
  *
  * @param array $salesRules
  * @param CatalogProductSimple $productForSalesRule1
  * @param CatalogProductSimple $productForSalesRule2
  */
 public function testApplySeveralSalesRules(array $salesRules, CatalogProductSimple $productForSalesRule1, CatalogProductSimple $productForSalesRule2)
 {
     // Preconditions
     $productForSalesRule1->persist();
     $productForSalesRule2->persist();
     // Create sales rules
     foreach ($salesRules as $key => $dataSet) {
         $salesRule[$key] = $this->fixtureFactory->createByCode('salesRule', ['dataset' => $dataSet]);
         $salesRule[$key]->persist();
     }
 }
Exemplo n.º 6
0
 /**
  * Update Sitemap Entity
  *
  * @param Sitemap $sitemap
  * @param CatalogProductSimple $product
  * @param CatalogCategory $catalog
  * @param CmsPage $cmsPage
  * @return void
  */
 public function testUpdateSitemap(Sitemap $sitemap, CatalogProductSimple $product, CatalogCategory $catalog, CmsPage $cmsPage)
 {
     // Preconditions
     $sitemap->persist();
     $product->persist();
     $catalog->persist();
     $cmsPage->persist();
     $filter = ['sitemap_filename' => $sitemap->getSitemapFilename(), 'sitemap_path' => $sitemap->getSitemapPath(), 'sitemap_id' => $sitemap->getSitemapId()];
     // Steps
     $this->sitemapIndex->open()->getSitemapGrid()->search($filter);
     $this->sitemapIndex->getSitemapGrid()->generate();
 }
 /**
  * Run update product simple entity test
  *
  * @param CatalogProductSimple $initialProduct
  * @param CatalogProductSimple $product
  * @return array
  */
 public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product)
 {
     // Preconditions
     $initialProduct->persist();
     $initialCategory = $initialProduct->hasData('category_ids') ? $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0] : null;
     $category = $product->hasData('category_ids') && $product->getCategoryIds()[0] ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : $initialCategory;
     // Steps
     $filter = ['sku' => $initialProduct->getSku()];
     $this->productGrid->open();
     $this->productGrid->getProductGrid()->searchAndOpen($filter);
     $this->editProductPage->getProductForm()->fill($product);
     $this->editProductPage->getFormPageActions()->save();
     return ['category' => $category];
 }
 /**
  * Create product URL Rewrite.
  *
  * @param CatalogProductSimple $product
  * @param UrlRewrite $urlRewrite
  * @return void
  */
 public function test(CatalogProductSimple $product, UrlRewrite $urlRewrite)
 {
     //Precondition
     $product->persist();
     $filter = ['id' => $product->getId()];
     //Steps
     $this->urlRewriteIndex->open();
     $this->urlRewriteIndex->getPageActionsBlock()->addNew();
     $this->urlRewriteEdit->getFormBlock()->fill($urlRewrite);
     $this->urlRewriteEdit->getProductGridBlock()->searchAndOpen($filter);
     $category = $product->hasData('category_ids') ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : null;
     $this->urlRewriteEdit->getTreeBlock()->selectCategory($category);
     $this->urlRewriteEdit->getFormBlock()->fill($urlRewrite);
     $this->urlRewriteEdit->getPageMainActions()->save();
 }
 /**
  * Run UpdateProductAttributeEntity test
  *
  * @param CatalogProductAttribute $productAttributeOriginal
  * @param CatalogProductAttribute $attribute
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductAttributeIndex $attributeIndex
  * @param CatalogProductAttributeNew $attributeNew
  * @param CatalogProductSimple $productSimple
  * @return array
  */
 public function testUpdateProductAttribute(CatalogProductAttribute $productAttributeOriginal, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, CatalogProductAttributeIndex $attributeIndex, CatalogProductAttributeNew $attributeNew, CatalogProductSimple $productSimple)
 {
     //Precondition
     $attributeSet->persist();
     $productAttributeOriginal->persist();
     $filter = ['attribute_code' => $productAttributeOriginal->getAttributeCode()];
     //Steps
     $attributeIndex->open();
     $attributeIndex->getGrid()->searchAndOpen($filter);
     $attributeNew->getAttributeForm()->fill($attribute);
     $attributeNew->getPageActions()->save();
     $attribute = $this->prepareAttribute($attribute, $productAttributeOriginal);
     $productSimple->persist();
     return ['product' => $this->prepareProduct($productSimple, $attribute, $attributeSet)];
 }
 /**
  * Run mass update product simple entity test.
  *
  * @param CatalogProductSimple $initialProduct
  * @param CatalogProductSimple $product
  * @param string $configData
  * @return array
  */
 public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product, $configData)
 {
     $this->configData = $configData;
     // Preconditions
     $initialProduct->persist();
     $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $configData])->run();
     // Steps
     $this->productGrid->open();
     $this->productGrid->getProductGrid()->updateAttributes([['sku' => $initialProduct->getSku()]]);
     $this->attributeMassActionPage->getAttributesBlockForm()->fill($product);
     $this->attributeMassActionPage->getFormPageActions()->save();
     $data = array_merge($initialProduct->getData(), $product->getData());
     $product = $this->objectManager->create('Magento\\Catalog\\Test\\Fixture\\CatalogProductSimple', ['data' => $data]);
     return ['category' => $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0], 'product' => $product];
 }
 /**
  * Create products in cart report entity
  *
  * @param Customer $customer
  * @param CatalogProductSimple $product
  * @param string $isGuest
  * @param BrowserInterface $browser
  * @return void
  */
 public function test(Customer $customer, CatalogProductSimple $product, $isGuest, BrowserInterface $browser)
 {
     // Preconditions
     $product->persist();
     //Steps
     $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     $productUrl = $_ENV['app_frontend_url'] . $product->getUrlKey() . '.html';
     $browser->open($productUrl);
     $this->catalogProductView->getViewBlock()->addToCart($product);
     if ($isGuest) {
         $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LogoutCustomerOnFrontendStep')->run();
         $browser->open($productUrl);
         $this->catalogProductView->getViewBlock()->addToCart($product);
     }
 }
 /**
  * Run update product simple entity test.
  *
  * @param CatalogProductSimple $initialProduct
  * @param CatalogProductSimple $product
  * @param string $configData
  * @return array
  */
 public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product, $configData = '')
 {
     $this->configData = $configData;
     // Preconditions
     $initialProduct->persist();
     $initialCategory = $initialProduct->hasData('category_ids') ? $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0] : null;
     $category = $product->hasData('category_ids') && $product->getCategoryIds()[0] ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : $initialCategory;
     $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $configData])->run();
     // Steps
     $filter = ['sku' => $initialProduct->getSku()];
     $this->productGrid->open();
     $this->productGrid->getProductGrid()->searchAndOpen($filter);
     $this->editProductPage->getProductForm()->fill($product);
     $this->editProductPage->getFormPageActions()->save();
     return ['category' => $category];
 }
 /**
  * Assert that widget with type Recently Viewed Products is present on category page
  *
  * @param CmsIndex $cmsIndex
  * @param AdminCache $adminCache
  * @param CatalogCategoryView $catalogCategoryView
  * @param BrowserInterface $browser
  * @param CatalogProductSimple $productSimple
  * @param Category $category
  * @param Customer $customer
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, AdminCache $adminCache, CatalogCategoryView $catalogCategoryView, BrowserInterface $browser, CatalogProductSimple $productSimple, Category $category, Customer $customer)
 {
     $this->browser = $browser;
     $this->cmsIndex = $cmsIndex;
     $this->catalogCategoryView = $catalogCategoryView;
     // Flush cache
     $adminCache->open();
     $adminCache->getActionsBlock()->flushMagentoCache();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     // Log in customer
     $customer->persist();
     $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     // Open products
     $productSimple->persist();
     $category->persist();
     $this->browser->open($_ENV['app_frontend_url'] . $productSimple->getUrlKey() . '.html');
     $this->checkRecentlyViewedBlockOnCategory($productSimple, $category);
 }
 /**
  * Assert that widget with type Recently Compared Products is present on Product Compare page
  *
  * @param CatalogProductCompare $catalogProductCompare
  * @param CmsIndex $cmsIndex
  * @param CatalogProductView $catalogProductView
  * @param BrowserInterface $browser
  * @param Widget $widget
  * @param CatalogProductSimple $productSimple1
  * @param CatalogProductSimple $productSimple2
  * @param AdminCache $adminCache
  * @var string
  * @return void
  */
 public function processAssert(CatalogProductCompare $catalogProductCompare, CmsIndex $cmsIndex, CatalogProductView $catalogProductView, BrowserInterface $browser, Widget $widget, CatalogProductSimple $productSimple1, CatalogProductSimple $productSimple2, AdminCache $adminCache)
 {
     // Flush cache
     $adminCache->open();
     $adminCache->getActionsBlock()->flushMagentoCache();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     $this->catalogProductCompare = $catalogProductCompare;
     $this->catalogProductView = $catalogProductView;
     $this->browser = $browser;
     $this->cmsIndex = $cmsIndex;
     $productSimple1->persist();
     $products[] = $productSimple1;
     $productSimple2->persist();
     $products[] = $productSimple2;
     $cmsIndex->open();
     $this->addProducts($products);
     $this->removeCompareProducts();
     \PHPUnit_Framework_Assert::assertTrue($this->catalogProductCompare->getWidgetView()->isWidgetVisible($widget, 'Recently Compared'), 'Widget is absent on Product Compare page.');
 }
 /**
  * Test product prices with tax.
  *
  * @param CatalogProductSimple $product
  * @param string $configData
  * @param SalesRule $salesRule [optional]
  * @param CatalogRule $catalogRule [optional]
  * @return void
  */
 public function test(CatalogProductSimple $product, $configData, SalesRule $salesRule = null, CatalogRule $catalogRule = null)
 {
     //Preconditions
     if ($salesRule !== null) {
         $salesRule->persist();
         $this->salesRule = $salesRule;
     }
     if ($catalogRule !== null) {
         $catalogRule->persist();
         $this->catalogRule = $catalogRule;
     }
     $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $configData])->run();
     $product->persist();
 }
 /**
  * Prepare data.
  *
  * @param Customer $customer
  * @param CatalogProductSimple $product
  * @return array
  */
 public function __prepare(Customer $customer, CatalogProductSimple $product)
 {
     $customer->persist();
     $product->persist();
     return ['customer' => $customer, 'product' => $product];
 }
 /**
  * Update Shopping Cart
  *
  * @param CatalogProductSimple $product
  * @return array
  */
 public function test(CatalogProductSimple $product)
 {
     // Preconditions
     $product->persist();
     $this->checkoutCart->getCartBlock()->clearShoppingCart();
     // Steps
     $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $productView = $this->catalogProductView->getViewBlock();
     $productView->fillOptions($product);
     $productView->setQty(1);
     $productView->clickAddToCart();
     $this->catalogProductView->getMessagesBlock()->waitSuccessMessage();
     $qty = $product->getCheckoutData()['qty'];
     $this->checkoutCart->open();
     $this->checkoutCart->getCartBlock()->getCartItem($product)->setQty($qty);
     $this->checkoutCart->getCartBlock()->updateShoppingCart();
     $cart['data']['items'] = ['products' => [$product]];
     return ['cart' => $this->fixtureFactory->createByCode('cart', $cart)];
 }
 /**
  * Create Sales Price Rule.
  *
  * @param SalesRule $salesRule
  * @param CatalogProductSimple $productForSalesRule1
  * @param CatalogProductSimple $productForSalesRule2
  * @param Customer $customer
  * @param string $conditionEntity
  */
 public function testCreateSalesRule(SalesRule $salesRule, CatalogProductSimple $productForSalesRule1, CatalogProductSimple $productForSalesRule2 = null, Customer $customer = null, $conditionEntity = null)
 {
     $replace = null;
     $this->salesRuleName = $salesRule->getName();
     // Prepare data
     if ($customer !== null) {
         $customer->persist();
     }
     $productForSalesRule1->persist();
     if ($productForSalesRule2 !== null) {
         $productForSalesRule2->persist();
         if ($conditionEntity !== null) {
             $replace = $this->prepareCondition($productForSalesRule2, $conditionEntity);
         }
     }
     // Steps
     $this->promoQuoteNew->open();
     $this->promoQuoteNew->getSalesRuleForm()->fill($salesRule, null, $replace);
     $this->promoQuoteNew->getFormPageActions()->save();
 }
 /**
  * Test Creation for CustomerReviewReportEntity
  *
  * @param Review $review
  * @param Customer $customer
  * @param $customerLogin
  * @param CatalogProductSimple $product
  * @param BrowserInterface $browser
  * @return array
  *
  * @SuppressWarnings(PHPMD.ConstructorWithNameAsEnclosingClass)
  */
 public function test(Review $review, Customer $customer, CatalogProductSimple $product, BrowserInterface $browser, $customerLogin)
 {
     // Preconditions
     $product->persist();
     $this->cmsIndex->open();
     if ($customerLogin == 'Yes') {
         $this->cmsIndex->getLinksBlock()->openLink("Log In");
         $this->customerAccountLogin->getLoginBlock()->login($customer);
     }
     // Steps
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->pageCatalogProductView->getReviewSummary()->getAddReviewLink()->click();
     $this->pageCatalogProductView->getReviewFormBlock()->fill($review);
     $this->pageCatalogProductView->getReviewFormBlock()->submit();
     return ['product' => $product];
 }
 /**
  * Test Creation for CustomerReviewReportEntity
  *
  * @param Review $review
  * @param Customer $customer
  * @param $customerLogin
  * @param CatalogProductSimple $product
  * @param BrowserInterface $browser
  * @return array
  *
  * @SuppressWarnings(PHPMD.ConstructorWithNameAsEnclosingClass)
  */
 public function test(Review $review, Customer $customer, CatalogProductSimple $product, BrowserInterface $browser, $customerLogin)
 {
     // Preconditions
     $product->persist();
     $this->cmsIndex->open();
     if ($customerLogin == 'Yes') {
         $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     }
     // Steps
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->pageCatalogProductView->getReviewSummary()->getAddReviewLink()->click();
     $this->pageCatalogProductView->getReviewFormBlock()->fill($review);
     $this->pageCatalogProductView->getReviewFormBlock()->submit();
     return ['product' => $product];
 }
 /**
  * Create products in cart report entity
  *
  * @param Customer $customer
  * @param CatalogProductSimple $product
  * @param string $isGuest
  * @param BrowserInterface $browser
  * @return void
  */
 public function test(Customer $customer, CatalogProductSimple $product, $isGuest, BrowserInterface $browser)
 {
     // Preconditions
     $product->persist();
     //Steps
     $this->cmsIndex->open()->getLinksBlock()->openLink("Log In");
     $this->customerAccountLogin->getLoginBlock()->login($customer);
     $productUrl = $_ENV['app_frontend_url'] . $product->getUrlKey() . '.html';
     $browser->open($productUrl);
     $this->catalogProductView->getViewBlock()->addToCart($product);
     if ($isGuest) {
         $this->customerAccountLogout->open();
         $browser->open($productUrl);
         $this->catalogProductView->getViewBlock()->addToCart($product);
     }
 }
Exemplo n.º 22
0
 /**
  * Generate Sitemap Entity
  *
  * @param Sitemap $sitemap
  * @param CatalogProductSimple $product
  * @param CatalogCategory $catalog
  * @param CmsPage $cmsPage
  * @return void
  */
 public function testGenerateSitemap(Sitemap $sitemap, CatalogProductSimple $product, CatalogCategory $catalog, CmsPage $cmsPage)
 {
     // Preconditions
     $product->persist();
     $catalog->persist();
     $cmsPage->persist();
     // Steps
     $this->sitemapIndex->open();
     $this->sitemapIndex->getGridPageActions()->addNew();
     $this->sitemapNew->getSitemapForm()->fill($sitemap);
     $this->sitemapNew->getSitemapPageActions()->saveAndGenerate();
 }
 /**
  * Create product
  *
  * @param CatalogProductSimple $product
  * @return void
  */
 public function test(CatalogProductSimple $product)
 {
     // Preconditions
     $product->persist();
 }
 /**
  * Create product URL Rewrite
  *
  * @param CatalogProductSimple $product
  * @param UrlRewrite $urlRewrite
  * @return void
  */
 public function testProductUrlRewrite(CatalogProductSimple $product, UrlRewrite $urlRewrite)
 {
     //Precondition
     $product->persist();
     $filter = ['id' => $product->getId()];
     //Steps
     $this->urlRewriteIndex->open();
     $this->urlRewriteIndex->getPageActionsBlock()->addNew();
     $this->urlRewriteEdit->getUrlRewriteTypeSelectorBlock()->selectType('For product');
     $this->urlRewriteEdit->getProductGridBlock()->searchAndOpen($filter);
     $this->urlRewriteEdit->getTreeBlock()->skipCategorySelection();
     $this->urlRewriteEdit->getFormBlock()->fill($urlRewrite);
     $this->urlRewriteEdit->getPageMainActions()->save();
 }
Exemplo n.º 25
0
 /**
  * Create products
  *
  * @param CatalogProductSimple $product
  * @param int $countProduct
  * @return string
  */
 protected function createProducts(CatalogProductSimple $product, $countProduct)
 {
     for ($i = 0; $i < $countProduct; $i++) {
         $product->persist();
     }
     return $product->getName();
 }