Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
AssertGlobalSearchProductName Class Reference
Inheritance diagram for AssertGlobalSearchProductName:

Public Member Functions

 processAssert (Dashboard $dashboard, GlobalSearch $search)
 
 toString ()
 

Detailed Description

Class AssertGlobalSearchProductName Assert that product name is present in search results

Definition at line 18 of file AssertGlobalSearchProductName.php.

Member Function Documentation

◆ processAssert()

processAssert ( Dashboard  $dashboard,
GlobalSearch  $search 
)

Assert that product name is present in search results

Parameters
Dashboard$dashboard
GlobalSearch$search
Returns
void

Definition at line 27 of file AssertGlobalSearchProductName.php.

28  {
29  $entity = $search->getDataFieldConfig('query')['source']->getEntity();
30  $product = $entity instanceof OrderInjectable
31  ? $entity->getEntityId()['products'][0]
32  : $entity;
33  $productName = $product->getName();
34  $isVisibleInResult = $dashboard->getAdminPanelHeader()->isSearchResultVisible($productName);
35 
36  \PHPUnit\Framework\Assert::assertTrue(
37  $isVisibleInResult,
38  'Product name ' . $productName . ' is absent in search results'
39  );
40  }
$entity
Definition: element.phtml:22

◆ toString()

toString ( )

Returns a string representation of the object.

Returns
string

Definition at line 47 of file AssertGlobalSearchProductName.php.

48  {
49  return 'Product name is present in search results';
50  }

The documentation for this class was generated from the following file: