本文整理汇总了PHP中PHPUnit_Framework_MockObject_MockObject::setLayout方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_MockObject_MockObject::setLayout方法的具体用法?PHP PHPUnit_Framework_MockObject_MockObject::setLayout怎么用?PHP PHPUnit_Framework_MockObject_MockObject::setLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_MockObject_MockObject
的用法示例。
在下文中一共展示了PHPUnit_Framework_MockObject_MockObject::setLayout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetItems
/**
* @covers \Magento\Sales\Block\Adminhtml\Order\Create\Items\Grid::getItems
*/
public function testGetItems()
{
$productId = 8;
$itemQty = 23;
$layoutMock = $this->getMock('Magento\\Framework\\View\\LayoutInterface');
$blockMock = $this->getMock('Magento\\Framework\\View\\Element\\AbstractBlock', ['getItems'], [], '', false);
$itemMock = $this->getMock('Magento\\Sales\\Model\\Quote\\Item', array('getProduct', 'setHasError', 'setQty', 'getQty', '__sleep', '__wakeup'), array(), '', false);
$productMock = $this->getMock('Magento\\Catalog\\Model\\Product', array('getStockItem', 'getID', '__sleep', '__wakeup'), array(), '', false);
$checkMock = $this->getMock('Magento\\Framework\\Object', ['getMessage', 'getHasError'], [], '', false);
$layoutMock->expects($this->once())->method('getParentName')->will($this->returnValue('parentBlock'));
$layoutMock->expects($this->once())->method('getBlock')->with('parentBlock')->will($this->returnValue($blockMock));
$blockMock->expects($this->once())->method('getItems')->will($this->returnValue(array($itemMock)));
$itemMock->expects($this->any())->method('getChildren')->will($this->returnValue(array($itemMock)));
$itemMock->expects($this->any())->method('getProduct')->will($this->returnValue($productMock));
$itemMock->expects($this->any())->method('getQty')->will($this->returnValue($itemQty));
$productMock->expects($this->any())->method('getId')->will($this->returnValue($productId));
$productMock->expects($this->any())->method('getStatus')->will($this->returnValue(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED));
$checkMock->expects($this->any())->method('getMessage')->will($this->returnValue('Message'));
$checkMock->expects($this->any())->method('getHasError')->will($this->returnValue(false));
$this->stockItemService->expects($this->once())->method('checkQuoteItemQty')->with($this->equalTo($productId), $this->equalTo($itemQty), $this->equalTo($itemQty))->will($this->returnValue($checkMock));
$this->block->getQuote()->setIsSuperMode(true);
$items = $this->block->setLayout($layoutMock)->getItems();
$this->assertEquals('Message', $items[0]->getMessage());
$this->assertEquals(true, $this->block->getQuote()->getIsSuperMode());
}
示例2: testSetGetLayout
public function testSetGetLayout()
{
$this->assertNull($this->_helper->getLayout());
$this->assertInstanceof(get_class($this->_helper), $this->_helper->setLayout(Mage::app()->getLayout()));
$this->assertInstanceOf('Mage_Core_Model_Layout', $this->_helper->getLayout());
}