Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
HostedproTest.php
Go to the documentation of this file.
1 <?php
7 
12 {
18  public function testCancelAction()
19  {
20  $order = $this->_objectManager->create(\Magento\Sales\Model\Order::class);
21  $session = $this->_objectManager->get(\Magento\Checkout\Model\Session::class);
22 
23  $quote = $this->_objectManager->create(\Magento\Quote\Model\Quote::class);
24  $quote->load('100000002', 'reserved_order_id');
25  $session->setQuoteId($quote->getId());
26  $session->setPaypalStandardQuoteId($quote->getId())->setLastRealOrderId('100000002');
27  $this->dispatch('paypal/hostedpro/cancel');
28 
29  $order->load('100000002', 'increment_id');
30  $this->assertEquals('canceled', $order->getState());
31  $this->assertEquals($session->getQuote()->getGrandTotal(), $quote->getGrandTotal());
32  $this->assertEquals($session->getQuote()->getItemsCount(), $quote->getItemsCount());
33  }
34 }
$quote
$order
Definition: order.php:55