本文整理匯總了PHP中Magento\Quote\Model\Quote\Item::getData方法的典型用法代碼示例。如果您正苦於以下問題:PHP Item::getData方法的具體用法?PHP Item::getData怎麽用?PHP Item::getData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Quote\Model\Quote\Item
的用法示例。
在下文中一共展示了Item::getData方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSetProduct
public function testSetProduct()
{
$productMock = $this->generateProductMock(self::PRODUCT_ID, self::PRODUCT_TYPE, self::PRODUCT_SKU, self::PRODUCT_NAME, self::PRODUCT_WEIGHT, self::PRODUCT_TAX_CLASS_ID, self::PRODUCT_COST);
$this->eventDispatcher->expects($this->once())->method('dispatch')->with('sales_quote_item_set_product', ['product' => $productMock, 'quote_item' => $this->model]);
$this->model->setProduct($productMock);
$this->assertEquals($productMock, $this->model->getProduct());
$this->assertEquals(self::PRODUCT_ID, $this->model->getProductId());
$this->assertEquals(self::PRODUCT_TYPE, $this->model->getData('product_type'));
$this->assertEquals(self::PRODUCT_SKU, $this->model->getSku());
$this->assertEquals(self::PRODUCT_NAME, $this->model->getName());
$this->assertEquals(self::PRODUCT_WEIGHT, $this->model->getWeight());
$this->assertEquals(self::PRODUCT_TAX_CLASS_ID, $this->model->getTaxClassId());
$this->assertEquals(self::PRODUCT_COST, $this->model->getBaseCost());
$this->assertNull($this->model->getIsQtyDecimal());
}
示例2: verifyItem
/**
* Verify that correct fields of item has been set
*
* @param \PHPUnit_Framework_MockObject_MockObject|\Magento\Quote\Model\Quote\Item $item
* @param array $itemData
*/
public function verifyItem(\Magento\Quote\Model\Quote\Item $item, $itemData)
{
foreach ($itemData as $key => $value) {
$this->assertEquals($value, $item->getData($key), 'item ' . $key . ' is incorrect');
}
}