Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertConfigurableAttributesAbsentOnProductPage.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
10 use Magento\Catalog\Test\Page\Product\CatalogProductView;
12 use Magento\Mtf\Client\BrowserInterface;
13 use Magento\Mtf\Constraint\AbstractConstraint;
14 
18 class AssertConfigurableAttributesAbsentOnProductPage extends AbstractConstraint
19 {
29  public function processAssert(
30  array $deletedProductAttributes,
31  BrowserInterface $browser,
32  CatalogProductView $catalogProductView,
34  ) {
35  $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
36  $pageOptions = $catalogProductView->getViewBlock()->getOptions($product)['configurable_options'];
37 
38  foreach ($deletedProductAttributes as $attribute) {
39  $attributeLabel = $attribute->getFrontendLabel();
40  \PHPUnit\Framework\Assert::assertFalse(
41  isset($pageOptions[$attributeLabel]),
42  "Configurable attribute '$attributeLabel' found on product page on frontend."
43  );
44  }
45  }
46 
52  public function toString()
53  {
54  return "Configurable attributes are absent on product page on frontend.";
55  }
56 }
processAssert(array $deletedProductAttributes, BrowserInterface $browser, CatalogProductView $catalogProductView, ConfigurableProduct $product)