Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCityBasedShippingRateChanged.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Checkout\Test\Page\CheckoutOnepage;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 
15 class AssertCityBasedShippingRateChanged extends AbstractConstraint
16 {
25  public function processAssert(CheckoutOnepage $checkoutOnepage, $shippingMethod, $isShippingAvailable)
26  {
27  if ($isShippingAvailable) {
28  \PHPUnit\Framework\Assert::assertTrue(
29  $checkoutOnepage->getShippingMethodBlock()->isLoaderAppeared(),
30  'Shipping rate has not been changed.'
31  );
32  }
33  $shippingAvailability = $isShippingAvailable ? 'available' : 'unavailable';
34  \PHPUnit\Framework\Assert::assertEquals(
35  $isShippingAvailable,
36  $checkoutOnepage->getShippingMethodBlock()->isShippingMethodAvailable($shippingMethod),
37  "Shipping rates for {$shippingMethod['shipping_service']} should be $shippingAvailability."
38  );
39  }
40 
46  public function toString()
47  {
48  return "Shipping rate has been changed.";
49  }
50 }
processAssert(CheckoutOnepage $checkoutOnepage, $shippingMethod, $isShippingAvailable)
$shippingMethod
Definition: popup.phtml:12