Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductNoImageInGrid.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Mtf\Fixture\InjectableFixture;
9 use Magento\Mtf\Constraint\AbstractConstraint;
10 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
11 
15 class AssertProductNoImageInGrid extends AbstractConstraint
16 {
24  public function processAssert(
25  CatalogProductIndex $productGrid,
26  InjectableFixture $product
27  ) {
28  $filter = ['sku' => $product->getSku()];
29  $productGrid->open();
30  $productGrid->getProductGrid()->search($filter);
31  $src = $productGrid->getProductGrid()->getBaseImageAttribute('src');
32  \PHPUnit\Framework\Assert::assertTrue(
33  strpos($src, '/placeholder/') !== false,
34  'Product image is displayed in product grid when it should not'
35  );
36  }
37 
43  public function toString()
44  {
45  return 'Product image is not displayed in product grid.';
46  }
47 }
processAssert(CatalogProductIndex $productGrid, InjectableFixture $product)