当前位置: 首页>>代码示例>>PHP>>正文


PHP Type::expects方法代码示例

本文整理汇总了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();
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:8,代码来源:ProductTest.php

示例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());
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:ProductTest.php

示例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));
 }
开发者ID:nja78,项目名称:magento2,代码行数:9,代码来源:ProductTest.php

示例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());
 }
开发者ID:opexsw,项目名称:magento2,代码行数:11,代码来源:ProductTest.php


注:本文中的Magento\Catalog\Model\Product\Type::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。