本文整理汇总了PHP中PHPUnit_Framework_MockObject_MockObject::getLayout方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_MockObject_MockObject::getLayout方法的具体用法?PHP PHPUnit_Framework_MockObject_MockObject::getLayout怎么用?PHP PHPUnit_Framework_MockObject_MockObject::getLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_MockObject_MockObject
的用法示例。
在下文中一共展示了PHPUnit_Framework_MockObject_MockObject::getLayout方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRenderLink
public function testRenderLink()
{
$blockHtml = 'test';
$name = 'test_name';
$this->context->getLayout()->expects($this->once())->method('renderElement')->with($name)->willReturn($blockHtml);
/** @var \Magento\Framework\View\Element\AbstractBlock $link */
$link = $this->getMockBuilder('Magento\\Framework\\View\\Element\\AbstractBlock')->disableOriginalConstructor()->getMock();
$link->expects($this->once())->method('getNameInLayout')->willReturn($name);
$this->assertEquals($blockHtml, $this->block->renderLink($link));
}
示例2: testGetLayout
public function testGetLayout()
{
$context = $this->getMock('Oro\\Component\\Layout\\ContextInterface');
$rootId = 'test_id';
$rawLayout = $this->getMockBuilder('Oro\\Component\\Layout\\RawLayout')->disableOriginalConstructor()->getMock();
$rootView = $this->getMockBuilder('Oro\\Component\\Layout\\BlockView')->disableOriginalConstructor()->getMock();
$layout = $this->getMockBuilder('Oro\\Component\\Layout\\Layout')->disableOriginalConstructor()->getMock();
$context->expects($this->once())->method('isResolved')->will($this->returnValue(false));
$context->expects($this->once())->method('resolve');
$this->registry->expects($this->once())->method('configureContext')->with($this->identicalTo($context));
$this->layoutManipulator->expects($this->at(0))->method('setBlockTheme')->with('RootTheme1', $this->identicalTo(null));
$this->layoutManipulator->expects($this->at(1))->method('setBlockTheme')->with(['RootTheme2', 'RootTheme3'], $this->identicalTo(null));
$this->layoutManipulator->expects($this->at(2))->method('setBlockTheme')->with(['TestTheme1', 'TestTheme2'], 'test_block');
$this->layoutManipulator->expects($this->at(3))->method('setBlockTheme')->with('TestTheme3', 'test_block');
$this->layoutManipulator->expects($this->once())->method('applyChanges')->with($this->identicalTo($context), false);
$this->rawLayoutBuilder->expects($this->once())->method('getRawLayout')->will($this->returnValue($rawLayout));
$this->blockFactory->expects($this->once())->method('createBlockView')->with($this->identicalTo($rawLayout), $this->identicalTo($context), $rootId)->will($this->returnValue($rootView));
$this->layoutBuilder->expects($this->once())->method('createLayout')->with($this->identicalTo($rootView))->will($this->returnValue($layout));
$rawLayout->expects($this->once())->method('getRootId')->will($this->returnValue($rootId));
$rawLayout->expects($this->once())->method('getBlockThemes')->will($this->returnValue([$rootId => ['RootTheme1', 'RootTheme2', 'RootTheme3'], 'test_block' => ['TestTheme1', 'TestTheme2', 'TestTheme3']]));
$layout->expects($this->at(0))->method('setBlockTheme')->with(['RootTheme1', 'RootTheme2', 'RootTheme3'], $this->identicalTo(null));
$layout->expects($this->at(1))->method('setBlockTheme')->with(['TestTheme1', 'TestTheme2', 'TestTheme3'], 'test_block');
$layout->expects($this->exactly(2))->method('setBlockTheme');
$this->layoutBuilder->setBlockTheme('RootTheme1')->setBlockTheme(['RootTheme2', 'RootTheme3'])->setBlockTheme(['TestTheme1', 'TestTheme2'], 'test_block')->setBlockTheme('TestTheme3', 'test_block');
$result = $this->layoutBuilder->getLayout($context, $rootId);
$this->assertSame($layout, $result);
}
示例3: testAddActionLayoutHandles
/**
* @magentoAppIsolation enabled
*/
public function testAddActionLayoutHandles()
{
$this->_model->getRequest()->setRouteName('test')->setControllerName('controller')->setActionName('action');
$this->_model->addActionLayoutHandles();
$handles = $this->_model->getLayout()->getUpdate()->getHandles();
$this->assertContains('test_controller_action', $handles);
}
示例4: testAddPageLayoutHandles
/**
* @magentoAppIsolation enabled
*/
public function testAddPageLayoutHandles()
{
$this->_model->getRequest()->setRouteName('test')->setControllerName('controller')->setActionName('action');
//$this->_model->addPageLayoutHandles(array());
$this->assertEmpty($this->_model->getLayout()->getUpdate()->getHandles());
$this->_model->getRequest()->setRouteName('catalog')->setControllerName('product')->setActionName('view');
$this->_model->addPageLayoutHandles(array('type' => 'simple'));
$handles = $this->_model->getLayout()->getUpdate()->getHandles();
$this->assertContains('default', $handles);
$this->assertContains('catalog_product_view', $handles);
$this->assertContains('catalog_product_view_type_simple', $handles);
}
示例5: testGetLayout
/**
* @covers \Magento\Framework\View\Result\Layout::getLayout()
*/
public function testGetLayout()
{
$this->assertSame($this->layout, $this->resultLayout->getLayout());
}
示例6: 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());
}