Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductCustomOptionsErrors.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Page\Product\CatalogProductView;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
15 class AssertProductCustomOptionsErrors extends AbstractConstraint
16 {
24  public function processAssert(
25  CatalogProductView $catalogProductView,
26  array $products
27  ) {
28  foreach ($products as $product) {
29  foreach ($product->getData('custom_options') as $option) {
30  \PHPUnit\Framework\Assert::assertTrue(
31  $catalogProductView->getCustomOptionsBlock()->isJsMessageVisible($option['title']),
32  'Required Custom Option ' . $option['title'] . " doesn't contain JS validation error."
33  );
34  }
35  }
36  }
37 
43  public function toString()
44  {
45  return "Every required product's Custom Option contains JS validation error.";
46  }
47 }
processAssert(CatalogProductView $catalogProductView, array $products)