Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertShippingMethodAvailableInCart.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 
15 class AssertShippingMethodAvailableInCart extends AbstractConstraint
16 {
17  /* tags */
18  const SEVERITY = 'low';
19  /* end tags */
20 
29  public function processAssert(CheckoutCart $checkoutCart, array $shippingExists, $requireReload = true)
30  {
31  if ($requireReload) {
32  $checkoutCart->open();
33  }
34 
35  \PHPUnit\Framework\Assert::assertEquals(
36  $checkoutCart->getShippingBlock()->isShippingCarrierMethodVisible(
37  $shippingExists['shipping_service'],
38  $shippingExists['shipping_method']
39  ),
40  $shippingExists['exists']
41  );
42  }
43 
49  public function toString()
50  {
51  return 'Shipping method in the shopping cart is or is not available as expected.';
52  }
53 }
processAssert(CheckoutCart $checkoutCart, array $shippingExists, $requireReload=true)