Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertSearchAttributeTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\CatalogSearch\Test\Page\AdvancedSearch;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
15 class AssertSearchAttributeTest extends AbstractConstraint
16 {
24  public function processAssert(
25  AdvancedSearch $advancedSearch,
26  array $attributeForSearch
27  ) {
28  $advancedSearch->open();
29  $availableAttributes = $advancedSearch->getForm()->getFormLabels();
30  if (isset($attributeForSearch['isVisible'])) {
31  \PHPUnit\Framework\Assert::assertTrue(
32  (false !== array_search($attributeForSearch['name'], $availableAttributes)),
33  'Attribute ' . $attributeForSearch['name'] . 'was not found in Advanced Search Page.'
34  );
35  } else {
36  \PHPUnit\Framework\Assert::assertTrue(
37  (false == array_search($attributeForSearch['name'], $availableAttributes)),
38  'Attribute ' . $attributeForSearch['name'] . ' was found in Advanced Search Page.'
39  );
40  }
41  }
42 
48  public function toString()
49  {
50  return 'Attribute was found in Advanced Search Page.';
51  }
52 }
processAssert(AdvancedSearch $advancedSearch, array $attributeForSearch)