Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductNotSearchableBySku.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\CatalogSearch\Test\Page\CatalogsearchResult;
10 use Magento\Cms\Test\Page\CmsIndex;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 use Magento\Mtf\Fixture\FixtureInterface;
13 
18 class AssertProductNotSearchableBySku extends AbstractConstraint
19 {
28  public function processAssert(
29  CatalogsearchResult $catalogSearchResult,
30  CmsIndex $cmsIndex,
31  FixtureInterface $product
32  ) {
33  $cmsIndex->open();
34  $cmsIndex->getSearchBlock()->search($product->getSku());
35  \PHPUnit\Framework\Assert::assertFalse(
36  $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible(),
37  'Product was found by SKU.'
38  );
39  }
40 
46  public function toString()
47  {
48  return "Product is not searchable by SKU.";
49  }
50 }
processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)