/**
  * Assert that filtered product is present on category page by attribute and another products are absent.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param ProcessList $processList
  * @param Browser $browser
  * @param CatalogCategory $category
  * @param InjectableFixture[] $products
  * @param string $searchProductsIndexes
  * @param string $filterLink
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, ProcessList $processList, Browser $browser, CatalogCategory $category, array $products, $searchProductsIndexes, $filterLink)
 {
     $processList->open()->getIndexManagementGrid()->massactionForAll('Reindex Data');
     $browser->open($_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html');
     $filter = $this->prepareFilter($products[$searchProductsIndexes], $filterLink);
     $catalogCategoryView->getLayeredNavigationBlock()->selectAttribute($filter);
     $this->verify($catalogCategoryView, $products, $searchProductsIndexes);
 }
 /**
  * Assert that displayed assigned products on category page equals passed from fixture.
  *
  * @param CatalogCategory $category
  * @param CatalogCategoryView $categoryView
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogCategory $category, CatalogCategoryView $categoryView, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html');
     $products = $category->getDataFieldConfig('category_products')['source']->getProducts();
     foreach ($products as $productFixture) {
         \PHPUnit_Framework_Assert::assertTrue($categoryView->getListProductBlock()->isProductVisible($productFixture), "Products '{$productFixture->getName()}' is not find.");
     }
 }
 /**
  * Assert that sitemap.xml file contains correct content according to dataset:
  *  - product url
  *  - category url
  *  - CMS page url
  *
  * @param CatalogProductSimple $product
  * @param CatalogCategory $category
  * @param CmsPage $cmsPage
  * @param Sitemap $sitemap
  * @param SitemapIndex $sitemapIndex
  * @return void
  */
 public function processAssert(CatalogProductSimple $product, CatalogCategory $category, CmsPage $cmsPage, Sitemap $sitemap, SitemapIndex $sitemapIndex)
 {
     $sitemapIndex->open()->getSitemapGrid()->sortGridByField('sitemap_id');
     $filter = ['sitemap_filename' => $sitemap->getSitemapFilename(), 'sitemap_path' => $sitemap->getSitemapPath()];
     $sitemapIndex->getSitemapGrid()->search($filter);
     $content = file_get_contents($sitemapIndex->getSitemapGrid()->getLinkForGoogle());
     $frontendUrl = str_replace('index.php/', '', $_ENV['app_frontend_url']);
     $urls = [$frontendUrl . $product->getUrlKey() . '.html', $frontendUrl . $category->getUrlKey() . '.html', $frontendUrl . $cmsPage->getIdentifier()];
     \PHPUnit_Framework_Assert::assertTrue($this->checkContent($content, $urls), "File '{$sitemap->getSitemapFilename()}' does not contains correct content.");
 }
Exemplo n.º 4
0
 /**
  * Assert that displayed category data on category page equals to passed from fixture.
  *
  * @param CatalogCategory $category
  * @param CatalogCategory $initialCategory
  * @param FixtureFactory $fixtureFactory
  * @param CatalogCategoryView $categoryView
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogCategory $category, CatalogCategory $initialCategory, FixtureFactory $fixtureFactory, CatalogCategoryView $categoryView, Browser $browser)
 {
     $product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default', 'data' => ['category_ids' => ['category' => $initialCategory]]]);
     $categoryData = array_merge($initialCategory->getData(), $category->getData());
     $product->persist();
     $url = $_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html';
     $browser->open($url);
     \PHPUnit_Framework_Assert::assertEquals($url, $browser->getUrl(), 'Wrong page URL.');
     if (isset($categoryData['name'])) {
         \PHPUnit_Framework_Assert::assertEquals(strtoupper($categoryData['name']), $categoryView->getTitleBlock()->getTitle(), 'Wrong page title.');
     }
     if (isset($categoryData['description'])) {
         \PHPUnit_Framework_Assert::assertEquals($categoryData['description'], $categoryView->getViewBlock()->getDescription(), 'Wrong category description.');
     }
     if (isset($categoryData['default_sort_by'])) {
         $sortBy = strtolower($categoryData['default_sort_by']);
         $sortType = $categoryView->getTopToolbar()->getSelectSortType();
         \PHPUnit_Framework_Assert::assertEquals($sortBy, $sortType, 'Wrong sorting type.');
     }
 }
 /**
  * Assert that category url rewrite not in grid.
  *
  * @param UrlRewriteIndex $urlRewriteIndex
  * @param CatalogCategory $category
  * @return void
  */
 public function processAssert(UrlRewriteIndex $urlRewriteIndex, CatalogCategory $category)
 {
     $urlRewriteIndex->open();
     $filter = ['request_path' => $category->getUrlKey()];
     \PHPUnit_Framework_Assert::assertFalse($urlRewriteIndex->getUrlRedirectGrid()->isRowVisible($filter), "URL Rewrite with request path '{$filter['request_path']}' is present in grid.");
 }
 /**
  * Assert category is not present on frontend.
  *
  * @param Browser $browser
  * @param CatalogCategoryView $categoryView
  * @param CatalogCategory $category
  * @return void
  */
 public function processAssert(Browser $browser, CatalogCategoryView $categoryView, CatalogCategory $category)
 {
     $browser->open($_ENV['app_frontend_url'] . $category->getUrlKey() . '.html');
     \PHPUnit_Framework_Assert::assertContains(self::NOT_FOUND_MESSAGE, $categoryView->getViewBlock()->getText(), 'Category is present on frontend.');
 }
 /**
  * Assert that old category URL lead to appropriate Category in frontend.
  *
  * @param CatalogCategory $category
  * @param Browser $browser
  * @param CatalogCategory $initialCategory
  * @param CatalogCategoryView $catalogCategoryView
  * @return void
  */
 public function processAssert(CatalogCategory $category, Browser $browser, CatalogCategory $initialCategory, CatalogCategoryView $catalogCategoryView)
 {
     $browser->open(str_replace('index', 'cron', $_ENV['app_frontend_url']));
     $browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html');
     \PHPUnit_Framework_Assert::assertEquals($catalogCategoryView->getTitleBlock()->getTitle(), strtoupper($category->getName()), 'Old category URL does not lead to appropriate Category in frontend.');
 }
 /**
  * Assert that filtered product is present on category page by price and another products are absent.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param Browser $browser
  * @param CatalogCategory $category
  * @param InjectableFixture[] $products
  * @param string $searchProductsIndexes
  * @param string $filterLink
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, Browser $browser, CatalogCategory $category, array $products, $searchProductsIndexes, $filterLink)
 {
     $browser->open($_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html');
     $catalogCategoryView->getLayeredNavigationBlock()->selectPrice($filterLink);
     $this->verify($catalogCategoryView, $products, $searchProductsIndexes);
 }