Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertProductPresentInShoppingCart.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Checkout\Test\Page\CheckoutCart;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
16 class AssertProductPresentInShoppingCart extends AbstractConstraint
17 {
25  public function processAssert(CheckoutCart $checkoutCart, array $products)
26  {
27  $checkoutCart->open();
28  foreach ($products as $product) {
29  \PHPUnit\Framework\Assert::assertTrue(
30  $checkoutCart->getCartBlock()->getCartItem($product)->isVisible(),
31  'Product ' . $product->getName() . ' is absent in shopping cart.'
32  );
33  }
34  }
35 
41  public function toString()
42  {
43  return 'All expected products are present in shopping cart.';
44  }
45 }