当前位置: 首页>>代码示例>>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;未经允许,请勿转载。