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

Public Member Functions

 processAssert (BrowserInterface $browser, CatalogProductView $catalogProductView, CatalogProductSimple $product, array $promotedProducts=null)
 
 toString ()
 

Data Fields

const SEVERITY = 'middle'
 

Detailed Description

Assert that product is displayed in up-sell section.

Definition at line 18 of file AssertProductUpSells.php.

Member Function Documentation

◆ processAssert()

processAssert ( BrowserInterface  $browser,
CatalogProductView  $catalogProductView,
CatalogProductSimple  $product,
array  $promotedProducts = null 
)

Assert that products are displayed in up-sell section.

Parameters
BrowserInterface$browser
CatalogProductView$catalogProductView
CatalogProductSimple$product
InjectableFixture[]|null$promotedProducts
Returns
void

Definition at line 33 of file AssertProductUpSells.php.

38  {
39  if (!$promotedProducts) {
40  $promotedProducts = $product->hasData('up_sell_products')
41  ? $product->getDataFieldConfig('up_sell_products')['source']->getProducts()
42  : [];
43  }
44 
45  $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
46  foreach ($promotedProducts as $promotedProduct) {
47  \PHPUnit\Framework\Assert::assertTrue(
48  $catalogProductView->getUpsellBlock()->getProductItem($promotedProduct)->isVisible(),
49  'Product \'' . $promotedProduct->getName()
50  . '\' is absent in up-sells products of a product \'' . $product->getName() . '\'.'
51  );
52  }
53  }

◆ toString()

toString ( )

Text success product is displayed in up-sell section.

Returns
string

Definition at line 60 of file AssertProductUpSells.php.

61  {
62  return 'Product is displayed in up-sell section.';
63  }

Field Documentation

◆ SEVERITY

const SEVERITY = 'middle'

Definition at line 21 of file AssertProductUpSells.php.


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