Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductDuplicatedInGrid.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 
16 class AssertProductDuplicatedInGrid extends AbstractConstraint
17 {
26  public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid)
27  {
28  $config = $product->getDataConfig();
29  $filter = [
30  'name' => $product->getName(),
31  'visibility' => $product->getVisibility(),
32  'status' => 'Disabled',
33  'sku' => $product->getSku() . '-1',
34  'type' => ucfirst($config['create_url_params']['type']) . ' Product',
35  'price_to' => number_format($product->getPrice(), 2),
36  ];
37 
38  $productGrid->open()
39  ->getProductGrid()
40  ->search($filter);
41 
42  $filter['price_to'] = '$' . $filter['price_to'];
43  \PHPUnit\Framework\Assert::assertTrue(
44  $productGrid->getProductGrid()->isRowVisible($filter, false),
45  'Product duplicate is absent in Products grid.'
46  );
47  }
48 
54  public function toString()
55  {
56  return 'The product has been successfully found, according to the filters.';
57  }
58 }
$config
Definition: fraud_order.php:17
processAssert(FixtureInterface $product, CatalogProductIndex $productGrid)