/**
  * Inject page.
  *
  * @param CmsPageIndex $cmsIndex
  * @param CmsPageEdit $cmsEdit
  * @param CmsPage $cmsOriginal
  * @param FixtureFactory $factory
  * @return array
  */
 public function __inject(CmsPageIndex $cmsIndex, CmsPageEdit $cmsEdit, CmsPage $cmsOriginal, FixtureFactory $factory)
 {
     $cmsOriginal->persist();
     $this->cmsIndex = $cmsIndex;
     $this->cmsEdit = $cmsEdit;
     $this->factory = $factory;
     return ['cmsOriginal' => $cmsOriginal];
 }
Ejemplo n.º 2
0
 /**
  * Delete CMS Page.
  *
  * @param CmsPage $cmsPage
  * @return void
  */
 public function test(CmsPage $cmsPage)
 {
     // Preconditions
     $cmsPage->persist();
     // Steps
     $this->cmsIndex->open();
     $this->cmsIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsPage->getTitle()]);
     $this->cmsEdit->getPageMainActions()->deleteAndAcceptAlert();
 }
 /**
  * Creation for assign Related Cart and Catalog Rules to BannerEntity test.
  *
  * @param Banner $banner
  * @param string $customer
  * @param string $customerSegment
  * @param CmsPage $cmsPage
  * @param string $widget
  * @param string $product
  * @param string $catalogPriceRule [optional]
  * @param string $cartPriceRule [optional]
  * @param bool $isCatalogRuleApplied [optional]
  * @return array
  */
 public function test(Banner $banner, CmsPage $cmsPage, $customer, $customerSegment, $widget, $product, $catalogPriceRule = null, $cartPriceRule = null, $isCatalogRuleApplied = false)
 {
     // Preconditions
     $customer = $this->createCustomer($customer);
     $customerSegment = $this->createCustomerSegment($customerSegment);
     $cmsPage->persist();
     $this->product = $this->createProduct($product);
     $banner = $this->createBanner($customerSegment, $banner);
     $this->createWidget($widget, $banner);
     $this->createRules($cartPriceRule, $catalogPriceRule);
     $filter = ['name' => $banner->getName()];
     // Steps
     $this->bannerIndex->open();
     $this->bannerIndex->getGrid()->searchAndOpen($filter);
     $this->bannerNew->getBannerForm()->openTab('related_promotions');
     /** @var \Enterprise\Banner\Test\Block\Adminhtml\Banner\Edit\Tab\RelatedPromotions $tab */
     $tab = $this->bannerNew->getBannerForm()->getTabElement('related_promotions');
     if (!empty($this->rules['banner_sales_rules'])) {
         $tab->getCartPriceRulesGrid()->searchAndSelect(['id' => $this->rules['banner_sales_rules']]);
     }
     if (!empty($this->rules['banner_catalog_rules'])) {
         $tab->getCatalogPriceRulesGrid()->searchAndSelect(['id' => $this->rules['banner_catalog_rules']]);
     }
     $this->bannerNew->getFormPageActions()->save();
     // Apply Catalog rule for asserts:
     $this->applyCatalogRule($isCatalogRuleApplied);
     return ['product' => $this->product, 'banner' => $banner, 'customer' => $customer, 'customerSegment' => $customerSegment];
 }
 /**
  * Generate sitemap test.
  *
  * @param Sitemap $sitemap
  * @param CatalogProductSimple $product
  * @param CatalogCategory $category
  * @param CmsPage $cmsPage
  * @return void
  */
 public function test(Sitemap $sitemap, CatalogProductSimple $product, CatalogCategory $category, CmsPage $cmsPage)
 {
     // Preconditions
     $product->persist();
     $category->persist();
     $cmsPage->persist();
     // Steps
     $this->sitemapIndex->open();
     $this->sitemapIndex->getGridPageActions()->addNew();
     $this->sitemapNew->getSitemapForm()->fill($sitemap);
     $this->sitemapNew->getFormPageActions()->saveAndGenerate();
 }