Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
All Data Structures Namespaces Files Functions Variables Pages
AssertCartIsEmpty.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Checkout\Test\Page\CheckoutCart;
11 use Magento\Mtf\Client\BrowserInterface;
12 use Magento\Mtf\Constraint\AbstractConstraint;
13 
18 class AssertCartIsEmpty extends AbstractConstraint
19 {
23  const TEXT_EMPTY_CART = 'You have no items in your shopping cart. Click here to continue shopping.';
24 
33  public function processAssert(CheckoutCart $checkoutCart, BrowserInterface $browser)
34  {
35  $checkoutCart->open();
36  $cartEmptyBlock = $checkoutCart->getCartEmptyBlock();
37 
38  \PHPUnit\Framework\Assert::assertEquals(
39  self::TEXT_EMPTY_CART,
40  $cartEmptyBlock->getText(),
41  'Wrong text on empty cart page.'
42  );
43 
44  $cartEmptyBlock->clickLinkToMainPage();
45  \PHPUnit\Framework\Assert::assertEquals(
46  $_ENV['app_frontend_url'],
47  $browser->getUrl(),
48  'Wrong link to main page on empty cart page.'
49  );
50  }
51 
57  public function toString()
58  {
59  return 'Shopping Cart is empty.';
60  }
61 }
processAssert(CheckoutCart $checkoutCart, BrowserInterface $browser)