Example #1
0
 /**
  * Initialize product.
  *
  * @return \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject
  */
 protected function _initProduct()
 {
     /** @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject $product */
     $product = $this->getMock('Magento\\Catalog\\Model\\Product', ['getName', '__wakeup', 'getIdentities'], [], '', false);
     $product->expects($this->any())->method('getName')->will($this->returnValue('Parent Product'));
     /** @var \Magento\Quote\Model\Quote\Item|\PHPUnit_Framework_MockObject_MockObject $item */
     $item = $this->getMock('Magento\\Quote\\Model\\Quote\\Item', [], [], '', false);
     $item->expects($this->any())->method('getProduct')->will($this->returnValue($product));
     $this->_renderer->setItem($item);
     return $product;
 }
Example #2
0
 public function testSetItem()
 {
     $item = $this->getMockBuilder('Magento\\Quote\\Model\\Quote\\Item\\AbstractItem')->disableOriginalConstructor()->getMock();
     $this->renderer->setItem($item);
     $this->assertEquals($item, $this->renderer->getItem());
 }