示例#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());
 }