コード例 #1
0
 public function testAroundItemToOrderItemNegative()
 {
     $productMock = $this->getMock('Magento\\Catalog\\Model\\Product', [], [], '', false);
     $productMock->expects($this->once())->method('getCustomOption')->with('bundle_selection_attributes')->will($this->returnValue(false));
     $this->quoteItemMock->expects($this->once())->method('getProduct')->will($this->returnValue($productMock));
     $this->orderItemMock->expects($this->never())->method('setProductOptions');
     $orderItem = $this->model->aroundConvert($this->subjectMock, $this->closureMock, $this->quoteItemMock, []);
     $this->assertSame($this->orderItemMock, $orderItem);
 }
コード例 #2
0
 public function testAroundItemToOrderItem()
 {
     $storeId = 1;
     $giftMessageId = 1;
     $isMessageAvailable = true;
     $this->quoteItemMock->expects($this->any())->method('getStoreId')->will($this->returnValue($storeId));
     $this->quoteItemMock->expects($this->any())->method('getGiftMessageId')->will($this->returnValue($giftMessageId));
     $this->helperMock->expects($this->once())->method('isMessagesAllowed')->with('item', $this->quoteItemMock, $storeId)->will($this->returnValue($isMessageAvailable));
     $this->orderItemMock->expects($this->once())->method('setGiftMessageId')->with($giftMessageId);
     $this->orderItemMock->expects($this->once())->method('setGiftMessageAvailable')->with($isMessageAvailable);
     $this->assertSame($this->orderItemMock, $this->model->aroundConvert($this->subjectMock, $this->closureMock, $this->quoteItemMock, []));
 }