예제 #1
0
 /**
  * @dataProvider invisibleStatusesProvider
  * @param array $invisibleStatuses
  * @param string $orderStatus
  * @param bool $expectedResult
  */
 public function testToHtmlOrderVisibleOnFront(array $invisibleStatuses, $orderStatus, $expectedResult)
 {
     $orderId = 5;
     $realOrderId = 100003332;
     $this->checkoutSession->expects($this->once())->method('getLastOrderId')->will($this->returnValue($orderId));
     $this->checkoutSession->expects($this->once())->method('getLastRealOrderId')->will($this->returnValue($realOrderId));
     $this->checkoutSession->expects($this->once())->method('getLastOrderStatus')->will($this->returnValue($orderStatus));
     $this->orderConfig->expects($this->any())->method('getInvisibleOnFrontStatuses')->will($this->returnValue($invisibleStatuses));
     $this->block->toHtml();
     $this->assertEquals($expectedResult, $this->block->getIsOrderVisible());
 }
예제 #2
0
 /**
  * @dataProvider invisibleStatusesProvider
  * @param array $invisibleStatuses
  * @param string $orderStatus
  * @param bool $expectedResult
  */
 public function testToHtmlOrderVisibleOnFront(array $invisibleStatuses, $orderStatus, $expectedResult)
 {
     $orderId = 5;
     $order = $this->getMock('Magento\\Sales\\Model\\Order', ['getId', '__wakeup', 'load', 'getStatus'], [], '', false);
     $order->expects($this->any())->method('load')->with($orderId)->will($this->returnValue($order));
     $order->expects($this->any())->method('getId')->will($this->returnValue($orderId));
     $order->expects($this->any())->method('getStatus')->will($this->returnValue($orderStatus));
     $this->checkoutSession->expects($this->once())->method('getLastOrderId')->will($this->returnValue($orderId));
     $this->orderConfig->expects($this->any())->method('getInvisibleOnFrontStatuses')->will($this->returnValue($invisibleStatuses));
     $this->orderFactory->expects($this->once())->method('create')->will($this->returnValue($order));
     $this->block->toHtml();
     $this->assertEquals($expectedResult, $this->block->getIsOrderVisible());
 }
예제 #3
0
 /**
  * @dataProvider invisibleStatusesProvider
  *
  * @param array $invisibleStatuses
  * @param bool $expectedResult
  */
 public function testToHtmlOrderVisibleOnFront(array $invisibleStatuses, $expectedResult)
 {
     $orderId = 5;
     $realOrderId = 100003332;
     $status = Order::STATE_PENDING_PAYMENT;
     $order = $this->getMockBuilder('Magento\\Sales\\Model\\Order')->disableOriginalConstructor()->getMock();
     $this->checkoutSession->expects($this->once())->method('getLastRealOrder')->willReturn($order);
     $order->expects($this->atLeastOnce())->method('getEntityId')->willReturn($orderId);
     $order->expects($this->atLeastOnce())->method('getIncrementId')->willReturn($realOrderId);
     $order->expects($this->atLeastOnce())->method('getStatus')->willReturn($status);
     $this->orderConfig->expects($this->any())->method('getInvisibleOnFrontStatuses')->willReturn($invisibleStatuses);
     $this->block->toHtml();
     $this->assertEquals($expectedResult, $this->block->getIsOrderVisible());
 }
예제 #4
0
 public function testCheckAdvancedAcceptingByPaymentMethod()
 {
     $this->initLayoutMock();
     $this->initOrderMock(self::LAST_REAL_ORDER_ID, Order::STATE_NEW);
     $this->initCheckoutSessionMock(self::LAST_REAL_ORDER_ID, true);
     $this->requestMock->expects($this->once())->method('getParam')->with('RESPMSG')->will($this->returnValue('message'));
     $this->blockMock->expects($this->at(0))->method('setData')->with('goto_section', 'paymentMethod')->will($this->returnSelf());
     $this->blockMock->expects($this->at(1))->method('setData')->with('error_msg', __('Your payment has been declined. Please try again.'))->will($this->returnSelf());
     $this->paymentMock->expects($this->once())->method('getMethod')->will($this->returnValue(Config::METHOD_PAYFLOWADVANCED));
     $payflowadvancedReturnUrl = new PayflowadvancedReturnUrl($this->contextMock, $this->checkoutSessionMock, $this->orderFactoryMock, $this->payflowlinkFactoryMock, $this->helperCheckoutMock, $this->loggerMock);
     $payflowadvancedReturnUrl->execute();
 }
예제 #5
0
 /**
  * @param $state
  * @param $restoreQuote
  * @param $expectedGotoSection
  * @dataProvider testNotAllowedOrderStateDataProvider
  */
 public function testExecuteNotAllowedOrderState($state, $restoreQuote, $expectedGotoSection)
 {
     $lastRealOrderId = '000000001';
     $this->viewMock->expects($this->once())->method('getLayout')->will($this->returnValue($this->layoutMock));
     $this->layoutMock->expects($this->once())->method('getBlock')->will($this->returnValue($this->blockMock));
     $this->checkoutSessionMock->expects($this->any())->method('getLastRealOrderId')->will($this->returnValue($lastRealOrderId));
     $this->checkoutSessionMock->expects($this->any())->method('getLastRealOrder')->will($this->returnValue($this->orderMock));
     $this->checkoutSessionMock->expects($this->any())->method('restoreQuote')->will($this->returnValue($restoreQuote));
     $this->orderFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->orderMock));
     $this->orderMock->expects($this->once())->method('loadByIncrementId')->with($lastRealOrderId)->will($this->returnSelf());
     $this->orderMock->expects($this->once())->method('getIncrementId')->will($this->returnValue($lastRealOrderId));
     $this->orderMock->expects($this->once())->method('getState')->will($this->returnValue($state));
     $this->blockMock->expects($this->at(0))->method('setData')->with('goto_section', $expectedGotoSection)->will($this->returnSelf());
     $this->blockMock->expects($this->at(1))->method('setData')->with('error_msg', __('Your payment has been declined. Please try again.'))->will($this->returnSelf());
     $this->returnUrl->execute();
 }
예제 #6
0
파일: Success.php 프로젝트: aiesh/magento2
 /**
  * @param Template\Context $context
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @param \Magento\Customer\Model\Session $customerSession
  * @param \Magento\Sales\Model\OrderFactory $orderFactory
  * @param \Magento\Sales\Model\Order\Config $orderConfig
  * @param \Magento\Framework\App\Http\Context $httpContext
  * @param \Magento\Customer\Helper\Session\CurrentCustomer $currentCustomer
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Customer\Model\Session $customerSession, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Order\Config $orderConfig, \Magento\Framework\App\Http\Context $httpContext, \Magento\Customer\Helper\Session\CurrentCustomer $currentCustomer, array $data = array())
 {
     parent::__construct($context, $checkoutSession, $customerSession, $orderFactory, $orderConfig, $httpContext, $data);
     $this->currentCustomer = $currentCustomer;
 }
예제 #7
0
 /**
  * Prepares block data
  *
  * @return void
  */
 protected function prepareBlockData()
 {
     parent::prepareBlockData();
     $this->addData(['order_has_downloadable' => $this->orderHasDownloadableProducts()]);
 }
예제 #8
0
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Sales\Model\Order\Config $orderConfig, \Magento\Framework\App\Http\Context $httpContext, \Orba\Payupl\Helper\Payment $paymentHelper, array $data = [])
 {
     parent::__construct($context, $checkoutSession, $orderConfig, $httpContext, $data);
     $this->paymentHelper = $paymentHelper;
 }