/** * Assert that prices on order review and customer order pages are equal to specified in dataset. * * @param array $prices * @param InjectableFixture $product * @param CheckoutCart $checkoutCart * @param CheckoutOnepage $checkoutOnepage * @param CheckoutOnepageSuccess $checkoutOnepageSuccess * @param CustomerOrderView $customerOrderView * @return void */ public function processAssert(array $prices, InjectableFixture $product, CheckoutCart $checkoutCart, CheckoutOnepage $checkoutOnepage, CheckoutOnepageSuccess $checkoutOnepageSuccess, CustomerOrderView $customerOrderView) { $this->checkoutOnepage = $checkoutOnepage; $this->customerOrderView = $customerOrderView; $checkoutCart->getProceedToCheckoutBlock()->proceedToCheckout(); $checkoutOnepage->getBillingBlock()->clickContinue(); $checkoutOnepage->getPaymentMethodsBlock()->selectPaymentMethod(['method' => 'check_money_order']); $checkoutOnepage->getPaymentMethodsBlock()->clickContinue(); $actualPrices = []; $actualPrices = $this->getReviewPrices($actualPrices, $product); $actualPrices = $this->getReviewTotals($actualPrices); $prices = $this->preparePrices($prices); //Order review prices verification $message = 'Prices on order review should be equal to defined in dataset.'; \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message); $checkoutOnepage->getReviewBlock()->placeOrder(); $checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(); $checkoutOnepageSuccess->getSuccessBlock()->openOrder(); $actualPrices = []; $actualPrices = $this->getOrderPrices($actualPrices, $product); $actualPrices = $this->getOrderTotals($actualPrices); //Frontend order prices verification $message = 'Prices on order view page should be equal to defined in dataset.'; \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message); }
/** * Assert that prices on order review and customer order pages are equal to specified in dataset. * * @param array $prices * @param InjectableFixture $product * @param CheckoutCart $checkoutCart * @param CheckoutOnepage $checkoutOnepage * @param CheckoutOnepageSuccess $checkoutOnepageSuccess * @param CustomerOrderView $customerOrderView * @param CmsIndex $cmsIndex * @return void */ public function processAssert(array $prices, InjectableFixture $product, CheckoutCart $checkoutCart, CheckoutOnepage $checkoutOnepage, CheckoutOnepageSuccess $checkoutOnepageSuccess, CustomerOrderView $customerOrderView, CmsIndex $cmsIndex) { $this->checkoutOnepage = $checkoutOnepage; $this->customerOrderView = $customerOrderView; $checkoutCart->getProceedToCheckoutBlock()->proceedToCheckout(); $cmsIndex->getCmsPageBlock()->waitPageInit(); $shippingMethod = ['shipping_service' => 'Flat Rate', 'shipping_method' => 'Fixed']; $checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($shippingMethod); $checkoutOnepage->getShippingMethodBlock()->clickContinue(); $checkoutOnepage->getPaymentBlock()->selectPaymentMethod(['method' => 'checkmo']); $actualPrices = []; $actualPrices = $this->getReviewPrices($actualPrices, $product); $actualPrices = $this->getReviewTotals($actualPrices); $prices = $this->preparePrices($prices); //Order review prices verification $message = 'Prices on order review should be equal to defined in dataset.'; \PHPUnit_Framework_Assert::assertEquals(array_diff_key($prices, ['cart_item_price_excl_tax' => null, 'cart_item_price_incl_tax' => null]), $actualPrices, $message); $checkoutOnepage->getPaymentBlock()->placeOrder(); $checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(); $checkoutOnepageSuccess->getSuccessBlock()->openOrder(); $actualPrices = []; $actualPrices = $this->getOrderPrices($actualPrices, $product); $actualPrices = $this->getOrderTotals($actualPrices); //Frontend order prices verification $message = 'Prices on order view page should be equal to defined in dataset.'; \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message); }
/** * Proceed to checkout * * @return void */ public function run() { $this->checkoutCart->open(); $this->checkoutCart->getProceedToCheckoutBlock()->proceedToCheckout(); }