Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCategoryInNavigationMenu.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Catalog\Test\Page\Category\CatalogCategoryView;
11 use Magento\Cms\Test\Page\CmsIndex;
12 use Magento\Mtf\Constraint\AbstractConstraint;
13 
17 class AssertCategoryInNavigationMenu extends AbstractConstraint
18 {
27  public function processAssert(
28  Category $category,
29  CatalogCategoryView $catalogCategoryView,
30  CmsIndex $cmsIndex
31  ) {
32  $cmsIndex->open();
33  if (($category->getIncludeInMenu() == 'Yes') && ($category->getIsActive() == 'Yes')) {
34  \PHPUnit\Framework\Assert::assertTrue(
35  $catalogCategoryView->getTopmenu()->isCategoryVisible($category->getName()),
36  'Expected that ' . $category->getName() . ' is visible in navigation menu, but it is not.'
37  );
38  } else {
39  \PHPUnit\Framework\Assert::assertFalse(
40  $catalogCategoryView->getTopmenu()->isCategoryVisible($category->getName()),
41  'Expected that ' . $category->getName() . ' is not visible in navigation menu, but it is.'
42  );
43  }
44  }
45 
51  public function toString()
52  {
53  return "All category's visibility in navigation menu are true";
54  }
55 }
processAssert(Category $category, CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex)