當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Item::expects方法代碼示例

本文整理匯總了PHP中Magento\Quote\Model\Quote\Item::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP Item::expects方法的具體用法?PHP Item::expects怎麽用?PHP Item::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Quote\Model\Quote\Item的用法示例。


在下文中一共展示了Item::expects方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testConvert

 /**
  * test for convert method
  */
 public function testConvert()
 {
     $this->quoteItemMock->expects($this->exactly(2))->method('getProduct')->willReturn($this->productMock);
     $this->productMock->expects($this->once())->method('getTypeInstance')->willReturn($this->productTypeMock);
     $this->productTypeMock->expects($this->once())->method('getOrderOptions')->with($this->productMock)->willReturn(['option']);
     $this->objectCopyServiceMock->expects($this->at(0))->method('getDataFromFieldset')->with('quote_convert_item', 'to_order_item', $this->quoteItemMock)->willReturn([]);
     $this->objectCopyServiceMock->expects($this->at(1))->method('getDataFromFieldset')->with('quote_convert_item', 'to_order_item_discount', $this->quoteItemMock)->willReturn([]);
     $this->orderItemFactoryMock->expects($this->once())->method('create')->willReturn($this->orderItemMock);
     $this->assertInstanceOf('Magento\\Sales\\Model\\Order\\Item', $this->converter->convert($this->quoteItemMock, []));
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:13,代碼來源:ToOrderItemTest.php

示例2: testInitTotalsNoItems

 public function testInitTotalsNoItems()
 {
     $address = $this->getMock('\\Magento\\Quote\\Model\\Quote\\Address', [], [], '', false);
     $this->item->expects($this->never())->method('getParentItemId');
     $this->model->init($this->model->getWebsiteId(), $this->model->getCustomerGroupId(), $this->model->getCouponCode());
     $this->model->initTotals([], $address);
 }
開發者ID:ViniciusAugusto,項目名稱:magento2,代碼行數:7,代碼來源:ValidatorTest.php

示例3: testGetBaseFinalRowDisplayPriceInclTax

 /**
  * @param $baseRowTotalInclTax
  * @param $baseRowWeeeTaxInclTax
  * @param $weeeEnabled
  * @param $expectedValue
  * @dataProvider testGetFinalDisplayPriceDataProvider
  */
 public function testGetBaseFinalRowDisplayPriceInclTax($baseRowTotalInclTax, $baseRowWeeeTaxInclTax, $weeeEnabled, $expectedValue)
 {
     $this->weeeHelper->expects($this->once())->method('isEnabled')->will($this->returnValue($weeeEnabled));
     $this->weeeHelper->expects($this->any())->method('getBaseRowWeeeTaxInclTax')->with($this->item)->will($this->returnValue($baseRowWeeeTaxInclTax));
     $this->item->expects($this->once())->method('getBaseRowTotalInclTax')->will($this->returnValue($baseRowTotalInclTax));
     $this->assertEquals($expectedValue, $this->renderer->getBaseFinalRowDisplayPriceInclTax());
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:14,代碼來源:RendererTest.php

示例4: testCompareItemWithoutOptionWithCompared

 /**
  * test compare two items first without options and second with options
  */
 public function testCompareItemWithoutOptionWithCompared()
 {
     $this->itemMock->expects($this->any())->method('getProductId')->will($this->returnValue(1));
     $this->comparedMock->expects($this->any())->method('getProductId')->will($this->returnValue(1));
     $this->comparedMock->expects($this->any())->method('getOptions')->will($this->returnValue([$this->getOptionMock('option-1', 1), $this->getOptionMock('option-2', 'option-value'), $this->getOptionMock('option-3', serialize(['value' => 'value-1', 'qty' => 2]))]));
     $this->itemMock->expects($this->any())->method('getOptions')->will($this->returnValue([]));
     $this->assertFalse($this->helper->compare($this->itemMock, $this->comparedMock));
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:11,代碼來源:CompareTest.php

示例5: testSaveModifiedItem

 public function testSaveModifiedItem()
 {
     $this->entitySnapshotMock->expects($this->exactly(2))->method('isModified')->with($this->quoteItemMock)->willReturn(true);
     $this->quoteItemMock->expects($this->once())->method('isOptionsSaved')->willReturn(false);
     $this->quoteItemMock->expects($this->once())->method('saveItemOptions');
     $this->resourceMock->expects($this->any())->method('getConnection')->willReturn($this->connectionMock);
     $this->assertEquals($this->model, $this->model->save($this->quoteItemMock));
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:8,代碼來源:ItemTest.php

示例6: testCompareWithEmptyValues

 /**
  * Verify that compare ignores empty options.
  */
 public function testCompareWithEmptyValues()
 {
     $this->itemMock->expects($this->any())->method('getProductId')->will($this->returnValue(1));
     $this->comparedMock->expects($this->any())->method('getProductId')->will($this->returnValue(1));
     $this->itemMock->expects($this->once())->method('getOptions')->willReturn([$this->getOptionMock('option-1', serialize(['non-empty-option' => 'test', 'empty_option' => '']))]);
     $this->comparedMock->expects($this->once())->method('getOptions')->willReturn([$this->getOptionMock('option-1', serialize(['non-empty-option' => 'test']))]);
     $this->assertTrue($this->helper->compare($this->itemMock, $this->comparedMock));
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:11,代碼來源:CompareTest.php

示例7: testGetTotalAmount

 public function testGetTotalAmount()
 {
     $rowTotal = 100;
     $taxAmount = 10;
     $hiddenTaxAmount = 2;
     $discountAmount = 20;
     $weeeTaxAppliedRowAmount = 10;
     $expectedResult = $rowTotal + $taxAmount + $hiddenTaxAmount - $discountAmount + $weeeTaxAppliedRowAmount;
     $this->itemMock->expects($this->once())->method('getRowTotal')->will($this->returnValue($rowTotal));
     $this->itemMock->expects($this->once())->method('getTaxAmount')->will($this->returnValue($taxAmount));
     $this->itemMock->expects($this->once())->method('getHiddenTaxAmount')->will($this->returnValue($hiddenTaxAmount));
     $this->itemMock->expects($this->once())->method('getDiscountAmount')->will($this->returnValue($discountAmount));
     $this->itemMock->expects($this->once())->method('getWeeeTaxAppliedRowAmount')->will($this->returnValue($weeeTaxAppliedRowAmount));
     $this->assertEquals($expectedResult, $this->block->getTotalAmount($this->itemMock));
 }
開發者ID:,項目名稱:,代碼行數:15,代碼來源:


注:本文中的Magento\Quote\Model\Quote\Item::expects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。