Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertWidgetProductLink.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Catalog\Test\Page\Product\CatalogProductView;
11 use Magento\Cms\Test\Page\CmsIndex;
13 use Magento\Mtf\Constraint\AbstractConstraint;
14 
18 class AssertWidgetProductLink extends AbstractConstraint
19 {
29  public function processAssert(
30  CmsIndex $cmsIndex,
31  CatalogProductView $productView,
32  Widget $widget,
34  ) {
35  // Flush cache
36  $cache->flush();
37 
38  $cmsIndex->open();
39  $cmsIndex->getTopmenu()->selectCategoryByName($widget->getWidgetInstance()[0]['entities']->getName());
40  $cmsIndex->getWidgetView()->clickToWidget($widget, $widget->getParameters()['anchor_text']);
41  $title = $productView->getTitleBlock()->getTitle();
42  \PHPUnit\Framework\Assert::assertEquals(
43  $widget->getParameters()['entities'][0]->getName(),
44  $title,
45  'Wrong product title.'
46  );
47  }
48 
54  public function toString()
55  {
56  return "Widget link on frontend system redirects to Product page defined in widget.";
57  }
58 }
$title
Definition: default.phtml:14