/**
  * Assert that apache redirect works by opening category page and asserting index.php in its url.
  *
  * @param CatalogCategory $category
  * @param CmsIndex $homePage
  * @param BrowserInterface $browser
  */
 public function processAssert(CatalogCategory $category, CmsIndex $homePage, BrowserInterface $browser)
 {
     $category->persist();
     $homePage->open();
     $homePage->getTopmenu()->selectCategory($category->getName());
     \PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'index.php') === false, 'Apache redirect for category does not work.');
 }
示例#2
0
 /**
  * @constructor
  * @param FixtureFactory $fixtureFactory
  * @param array $params
  * @param array|int $data
  */
 public function __construct(FixtureFactory $fixtureFactory, array $params, $data = [])
 {
     $this->params = $params;
     if (isset($data['dataSet'])) {
         $this->parentCategory = $fixtureFactory->createByCode('catalogCategory', ['dataSet' => $data['dataSet']]);
         if (!$this->parentCategory->hasData('id')) {
             $this->parentCategory->persist();
         }
         $this->data = $this->parentCategory->getId();
     } elseif (isset($data['data']) && isset($data['parent_category'])) {
         $this->data = $data['data'];
         $this->parentCategory = $data['parent_category'];
     } else {
         $this->data = $data;
     }
 }
 /**
  * Prepare data.
  *
  * @param CatalogCategory $category
  * @param CatalogProduct $productGrid
  * @param CatalogProductEdit $editProductPage
  * @param FixtureFactory $fixtureFactory
  * @return void
  */
 public function __prepare(CatalogCategory $category, CatalogProduct $productGrid, CatalogProductEdit $editProductPage, FixtureFactory $fixtureFactory)
 {
     $this->category = $category;
     $this->category->persist();
     $this->productGrid = $productGrid;
     $this->editProductPage = $editProductPage;
     $this->fixtureFactory = $fixtureFactory;
 }
 /**
  * Delete category.
  *
  * @param CatalogCategory $category
  * @return void
  */
 public function test(CatalogCategory $category)
 {
     // Preconditions:
     $category->persist();
     // Steps:
     $this->catalogCategoryIndex->open();
     $this->catalogCategoryIndex->getTreeCategories()->selectCategory($category);
     $this->catalogCategoryIndex->getFormPageActions()->deleteAndAcceptAlert();
 }
 /**
  * Assert that created Order By Sku widget displayed on frontend in Catalog.
  *
  * @param CatalogCategory $category
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param Widget $widget
  * @param Cache $adminCache
  * @return void
  */
 public function processAssert(CatalogCategory $category, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, Widget $widget, Cache $adminCache)
 {
     $category->persist();
     // Flush cache
     $adminCache->open();
     $adminCache->getPageActions()->flushCacheStorage();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($category->getName());
     $errors = $catalogCategoryView->getWidgetView()->checkWidget($widget, "Order by SKU");
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
 /**
  * Prepare configuration and create customer.
  *
  * @param Customer $customer
  * @param CatalogCategory $category
  * @return array
  */
 public function __prepare(Customer $customer, CatalogCategory $category)
 {
     $customer->persist();
     $category->persist();
     return ['customer' => $customer, 'category' => $category];
 }
 /**
  * Prepare data.
  *
  * @param CatalogCategory $category
  * @return array
  */
 public function __prepare(CatalogCategory $category)
 {
     $category->persist();
     return ['category' => $category];
 }
 /**
  * Injection data.
  *
  * @param FixtureFactory $fixtureFactory
  * @return array
  */
 public function __inject(FixtureFactory $fixtureFactory)
 {
     $this->category = $fixtureFactory->createByCode('catalogCategory', ['dataSet' => 'anchor_category']);
     $this->category->persist();
     return ['category' => $this->category];
 }
 /**
  * Update category.
  *
  * @param CatalogCategory $category
  * @param CatalogCategory $initialCategory
  * @param string $unassignedProductsKeys [optional]
  * @return array
  */
 public function test(CatalogCategory $category, CatalogCategory $initialCategory, $unassignedProductsKeys = '')
 {
     $this->unassignedProductsKeys = $unassignedProductsKeys;
     $initialCategory->persist();
     $this->catalogCategoryIndex->open();
     $this->catalogCategoryIndex->getTreeCategories()->selectCategory($initialCategory);
     $category = $this->updateCategoryFixture($initialCategory, $category);
     $this->catalogCategoryIndex->getCategoryForm()->fill($category);
     $this->catalogCategoryIndex->getFormPageActions()->save();
     return ['category' => $category, 'unassignedProducts' => $this->unassignedProducts];
 }
 /**
  * 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();
 }