Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertSearchTermInGrid.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 
17 class AssertSearchTermInGrid extends AbstractConstraint
18 {
32  public function processAssert(CatalogSearchIndex $indexPage, CatalogSearchQuery $searchTerm)
33  {
34  $grid = $indexPage->open()->getGrid();
35  $filters = [
36  'search_query' => $searchTerm->getQueryText(),
37  'store_id' => $searchTerm->getStoreId(),
38  'results_from' => $searchTerm->getNumResults(),
39  'popularity_from' => $searchTerm->getPopularity(),
40  'redirect' => $searchTerm->getRedirect(),
41  'display_in_terms' => strtolower($searchTerm->getDisplayInTerms()),
42  ];
43 
44  $filters = array_filter($filters);
45  $grid->search($filters);
46  unset($filters['store_id']);
47  \PHPUnit\Framework\Assert::assertTrue(
48  $grid->isRowVisible($filters, false),
49  'Row terms according to the filters is not found.'
50  );
51  }
52 
58  public function toString()
59  {
60  return 'Row term according to the filters is not found.';
61  }
62 }
processAssert(CatalogSearchIndex $indexPage, CatalogSearchQuery $searchTerm)
$filters
Definition: uploader.phtml:11