HostedproTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Paypal\Controller;
  7. /**
  8. * @magentoDataFixture Magento/Sales/_files/order.php
  9. */
  10. class HostedproTest extends \Magento\TestFramework\TestCase\AbstractController
  11. {
  12. /**
  13. * @magentoDataFixture Magento/Paypal/_files/quote_payment_express.php
  14. * @magentoConfigFixture current_store payment/paypal_hostedpro/active 1
  15. * @magentoConfigFixture current_store paypal/general/business_account merchant_2012050718_biz@example.com
  16. */
  17. public function testCancelAction()
  18. {
  19. $order = $this->_objectManager->create(\Magento\Sales\Model\Order::class);
  20. $session = $this->_objectManager->get(\Magento\Checkout\Model\Session::class);
  21. $quote = $this->_objectManager->create(\Magento\Quote\Model\Quote::class);
  22. $quote->load('100000002', 'reserved_order_id');
  23. $session->setQuoteId($quote->getId());
  24. $session->setPaypalStandardQuoteId($quote->getId())->setLastRealOrderId('100000002');
  25. $this->dispatch('paypal/hostedpro/cancel');
  26. $order->load('100000002', 'increment_id');
  27. $this->assertEquals('canceled', $order->getState());
  28. $this->assertEquals($session->getQuote()->getGrandTotal(), $quote->getGrandTotal());
  29. $this->assertEquals($session->getQuote()->getItemsCount(), $quote->getItemsCount());
  30. }
  31. }