Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertWidgetCatalogCategoryLink.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;
13 use Magento\Mtf\Constraint\AbstractConstraint;
14 
19 class AssertWidgetCatalogCategoryLink extends AbstractConstraint
20 {
21  /* tags */
22  const SEVERITY = 'low';
23  /* end tags */
24 
35  public function processAssert(
36  CmsIndex $cmsIndex,
37  CatalogCategoryView $categoryView,
38  Widget $widget,
40  ) {
41  // Flush cache
42  $cache->flush();
43 
44  $cmsIndex->open();
45  $widgetText = $widget->getParameters()['anchor_text'];
46 
47  \PHPUnit\Framework\Assert::assertTrue(
48  $cmsIndex->getWidgetView()->isWidgetVisible($widget, $widgetText),
49  'Widget with type catalog category link is absent on Home page.'
50  );
51 
52  $cmsIndex->getWidgetView()->clickToWidget($widget, $widgetText);
53  $title = $categoryView->getTitleBlock()->getTitle();
54  \PHPUnit\Framework\Assert::assertEquals(
55  $widget->getParameters()['entities'][0]->getName(),
56  $title,
57  'Wrong category title.'
58  );
59 
60  $cmsIndex->getFooterBlock()->openAdvancedSearch();
61  \PHPUnit\Framework\Assert::assertTrue(
62  $cmsIndex->getWidgetView()->isWidgetVisible($widget, $widgetText),
63  'Widget with type catalog category link is absent on Advanced Search page.'
64  );
65  }
66 
72  public function toString()
73  {
74  return "Created widget displayed on frontend on Home and Advanced Search pages.";
75  }
76 }
$title
Definition: default.phtml:14