Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductNotInGrid.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 use Magento\Mtf\Fixture\FixtureInterface;
12 
17 class AssertProductNotInGrid extends AbstractConstraint
18 {
26  public function processAssert($product, CatalogProductIndex $productGrid)
27  {
28  $products = is_array($product) ? $product : [$product];
29  foreach ($products as $product) {
30  $filter = ['sku' => $product->getSku(), 'name' => $product->getName()];
31  $productGrid->open();
32  \PHPUnit\Framework\Assert::assertFalse(
33  $productGrid->getProductGrid()->isRowVisible($filter),
34  "Product with sku \"{$filter['sku']}\" and name \"{$filter['name']}\" is attend in Products grid."
35  );
36  }
37  }
38 
44  public function toString()
45  {
46  return 'Assertion that product is absent in products grid.';
47  }
48 }
processAssert($product, CatalogProductIndex $productGrid)