Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertCatalogPriceRuleOnOnepageCheckout.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Checkout\Test\Page\CheckoutOnepage;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 
16 class AssertCatalogPriceRuleOnOnepageCheckout extends AbstractConstraint
17 {
18  /* tags */
19  const SEVERITY = 'high';
20  /* end tags */
21 
33  public function processAssert(
34  CheckoutOnepage $checkoutOnepage,
35  Customer $customer,
36  array $products,
37  array $cartPrice,
38  array $shipping,
39  array $payment
40  ) {
41  $this->objectManager->create(
42  \Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class,
43  ['customer' => $customer]
44  )->run();
45  $this->objectManager->create(
46  \Magento\Checkout\Test\TestStep\AddProductsToTheCartStep::class,
47  ['products' => $products]
48  )->run();
49  $this->objectManager->create(\Magento\Checkout\Test\TestStep\ProceedToCheckoutStep::class)->run();
50  $this->objectManager->create(
51  \Magento\Checkout\Test\TestStep\FillBillingInformationStep::class,
52  ['customer' => $customer, 'checkoutMethod' => 'register']
53  )->run();
54  $this->objectManager->create(
55  \Magento\Checkout\Test\TestStep\FillShippingMethodStep::class,
56  ['shipping' => $shipping]
57  )->run();
58  $this->objectManager->create(
59  \Magento\Checkout\Test\TestStep\SelectPaymentMethodStep::class,
60  ['payment' => $payment]
61  )->run();
62  $actualPrices['grand_total'] = $checkoutOnepage->getReviewBlock()->getGrandTotal();
63  $actualPrices['sub_total'] = $checkoutOnepage->getReviewBlock()->getSubtotal();
64  $expectedPrices['grand_total'] = $cartPrice['grand_total'];
65  $expectedPrices['sub_total'] = $cartPrice['sub_total'];
66  \PHPUnit\Framework\Assert::assertEquals(
67  $expectedPrices,
68  $actualPrices,
69  'Wrong total cart prices are displayed.'
70  . "\nExpected: " . implode(PHP_EOL, $expectedPrices)
71  . "\nActual: " . implode(PHP_EOL, $actualPrices) . "\n"
72  );
73  }
74 
80  public function toString()
81  {
82  return 'Displayed catalog price rule data on OnePage Checkout equals to passed from fixture.';
83  }
84 }
processAssert(CheckoutOnepage $checkoutOnepage, Customer $customer, array $products, array $cartPrice, array $shipping, array $payment)
$customer
Definition: customers.php:11
$payment
Definition: order.php:17