Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCategoryCaching.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Constraint\AbstractConstraint;
13 use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
14 use Magento\Cms\Test\Page\CmsIndex;
16 
20 class AssertCategoryCaching extends AbstractConstraint
21 {
33  public function processAssert(
34  Category $category,
35  CatalogCategoryView $categoryView,
36  CmsIndex $cmsIndex,
37  AssertProductInCategory $assertProduct,
38  AssertProductNotVisibleInCategory $assertProductNotVisible,
39  Cron $cron
40  ) {
41  $products = $category->getDataFieldConfig('category_products')['source']->getProducts();
42  foreach ($products as $product) {
43  $assertProductNotVisible->processAssert($categoryView, $cmsIndex, $product, $category);
44  }
45 
46  $cron->run();
47  $cron->run();
48 
49  foreach ($products as $product) {
50  $assertProduct->processAssert($categoryView, $cmsIndex, $product, $category);
51  }
52  }
53 
59  public function toString()
60  {
61  return 'Category products are visible after indexing.';
62  }
63 }
processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, FixtureInterface $product, Category $category)
processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, FixtureInterface $product, Category $category=null)
processAssert(Category $category, CatalogCategoryView $categoryView, CmsIndex $cmsIndex, AssertProductInCategory $assertProduct, AssertProductNotVisibleInCategory $assertProductNotVisible, Cron $cron)