Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertAttributeSetForm.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
11 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductSetEdit;
12 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductSetIndex;
13 use Magento\Mtf\Constraint\AbstractConstraint;
14 
19 class AssertAttributeSetForm extends AbstractConstraint
20 {
32  public function processAssert(
33  CatalogProductSetIndex $productSet,
34  CatalogProductSetEdit $productSetEdit,
35  CatalogAttributeSet $attributeSet,
36  CatalogProductAttribute $productAttribute = null
37  ) {
38  $filterAttribute = [
39  'set_name' => $attributeSet->getAttributeSetName(),
40  ];
41  $productSet->open();
42  $productSet->getGrid()->searchAndOpen($filterAttribute);
43  \PHPUnit\Framework\Assert::assertEquals(
44  $filterAttribute['set_name'],
45  $productSetEdit->getAttributeSetEditBlock()->getAttributeSetName(),
46  'The attribute set wasn\'t found.'
47  . "\nExpected: " . $filterAttribute['set_name']
48  . "\nActual: " . $productSetEdit->getAttributeSetEditBlock()->getAttributeSetName()
49  );
50  if ($productAttribute !== null) {
51  $attributeLabel = $productAttribute->getFrontendLabel();
52  \PHPUnit\Framework\Assert::assertTrue(
53  $productSetEdit->getAttributeSetEditBlock()->checkProductAttribute($attributeLabel),
54  "Product Attribute is absent on Attribute Set Groups"
55  );
56  }
57  }
58 
64  public function toString()
65  {
66  return 'Data from the Attribute Set form matched with fixture';
67  }
68 }
processAssert(CatalogProductSetIndex $productSet, CatalogProductSetEdit $productSetEdit, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttribute=null)