本文整理汇总了PHP中Magento\Catalog\Model\Product\Type::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::expects方法的具体用法?PHP Type::expects怎么用?PHP Type::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Model\Product\Type
的用法示例。
在下文中一共展示了Type::expects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetTypeId
public function testGetTypeId()
{
$productType = $this->getMockBuilder('Magento\\Catalog\\Model\\Product\\Type\\Virtual')->disableOriginalConstructor()->getMockForAbstractClass();
$this->productTypeInstanceMock->expects($this->exactly(2))->method('factory')->will($this->returnValue($productType));
$this->model->getTypeInstance();
$this->model->setTypeId('typeId');
$this->model->getTypeInstance();
}
示例2: configureSaveTest
/**
* Configure environment for `testSave` and `testSaveAndDuplicate` methods
* @return array
*/
protected function configureSaveTest()
{
$productTypeMock = $this->getMockBuilder('Magento\\Catalog\\Model\\Product\\Type\\Simple')->disableOriginalConstructor()->setMethods(['beforeSave', 'save'])->getMock();
$productTypeMock->expects($this->once())->method('beforeSave')->will($this->returnSelf());
$productTypeMock->expects($this->once())->method('save')->will($this->returnSelf());
$this->productTypeInstanceMock->expects($this->once())->method('factory')->with($this->model)->will($this->returnValue($productTypeMock));
$this->model->getResource()->expects($this->any())->method('addCommitCallback')->will($this->returnSelf());
$this->model->getResource()->expects($this->any())->method('commit')->will($this->returnSelf());
}
示例3: testGetFinalPricePreset
public function testGetFinalPricePreset()
{
$finalPrice = 9.99;
$qty = 1;
$this->model->setQty($qty);
$this->model->setFinalPrice($finalPrice);
$this->productTypeInstanceMock->expects($this->never())->method('priceFactory');
$this->assertEquals($finalPrice, $this->model->getFinalPrice($qty));
}
示例4: testGetGalleryAttributeBackend
public function testGetGalleryAttributeBackend()
{
$productType = $this->getMockBuilder('Magento\\Catalog\\Model\\Product\\Type\\AbstractType')->setMethods(['getEditableAttributes'])->disableOriginalConstructor()->getMockForAbstractClass();
$this->productTypeInstanceMock->expects($this->any())->method('factory')->will($this->returnValue($productType));
$attributeMediaGallery = $this->getMockBuilder('\\Magento\\Eav\\Model\\Entity\\Attribute\\AbstractAttribute')->setMethods(['__wakeup', 'getAttributeCode', 'getBackend'])->disableOriginalConstructor()->getMockForAbstractClass();
$attributeMediaGallery->expects($this->any())->method('getAttributeCode')->willReturn('media_gallery');
$expectedValue = 'expected';
$attributeMediaGallery->expects($this->once())->method('getBackend')->willReturn($expectedValue);
$productType->expects($this->once())->method('getEditableAttributes')->willReturn(['media_gallery' => $attributeMediaGallery]);
$this->assertEquals($expectedValue, $this->model->getGalleryAttributeBackend());
}