Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductAttributeIsUsedPromoRules.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Constraint\AbstractConstraint;
10 use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
12 use Magento\CatalogRule\Test\Page\Adminhtml\CatalogRuleNew;
13 use Magento\CatalogRule\Test\Page\Adminhtml\CatalogRuleIndex;
14 
18 class AssertProductAttributeIsUsedPromoRules extends AbstractConstraint
19 {
28  public function processAssert(
29  CatalogRuleIndex $catalogRuleIndex,
30  CatalogRuleNew $catalogRuleNew,
31  CatalogProductAttribute $attribute
32  ) {
33  $catalogRuleIndex->open();
34  $catalogRuleIndex->getGridPageActions()->addNew();
35  $catalogRuleNew->getEditForm()->openSection('conditions');
36 
38  $conditionsSection = $catalogRuleNew->getEditForm()->getSection('conditions');
39  \PHPUnit\Framework\Assert::assertTrue(
40  $conditionsSection->isAttributeInConditions($attribute),
41  'Product attribute can\'t be used on promo rules conditions.'
42  );
43  }
44 
50  public function toString()
51  {
52  return 'Product attribute can be used on promo rules conditions.';
53  }
54 }