本文整理匯總了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, []));
}
示例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);
}
示例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());
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}