Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertWidgetAbsentOnFrontendHome.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Cms\Test\Page\CmsIndex;
11 use Magento\Mtf\Constraint\AbstractConstraint;
13 
17 class AssertWidgetAbsentOnFrontendHome extends AbstractConstraint
18 {
28  public function processAssert(
29  CmsIndex $cmsIndex,
30  Widget $widget,
31  Cache $cache,
32  array $caches = []
33  ) {
34  // Flush cache
35  if (!in_array('Invalidated', $caches)) {
36  $cache->flush();
37  }
38  $cmsIndex->open();
39  $widgetText = $widget->getParameters()['anchor_text'];
40  \PHPUnit\Framework\Assert::assertFalse(
41  $cmsIndex->getWidgetView()->isWidgetVisible($widget, $widgetText),
42  'Widget is present on Home page.'
43  );
44  }
45 
52  public function toString()
53  {
54  return "Widget is absent on Home page.";
55  }
56 }
processAssert(CmsIndex $cmsIndex, Widget $widget, Cache $cache, array $caches=[])