本文整理汇总了PHP中Magento\Framework\View\Layout::getBlockSingleton方法的典型用法代码示例。如果您正苦于以下问题:PHP Layout::getBlockSingleton方法的具体用法?PHP Layout::getBlockSingleton怎么用?PHP Layout::getBlockSingleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\View\Layout
的用法示例。
在下文中一共展示了Layout::getBlockSingleton方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetBlockSingleton
/**
* @param array $type
* @param array $blockInstance
* @dataProvider getBlockSingletonDataProvider
*/
public function testGetBlockSingleton($type, $blockInstance, $isAbstract)
{
$blockMock = $this->getMock($blockInstance, [], [], '', false);
$this->generatorBlockMock->expects($this->once())->method('createBlock')->will($this->returnValue($blockMock));
if ($isAbstract) {
$blockMock->expects($this->any())->method('setLayout')->with($this->equalTo($this->model))->will($this->returnSelf());
}
$this->assertInstanceOf($blockInstance, $this->model->getBlockSingleton($type));
// singleton test
$this->assertInstanceOf($blockInstance, $this->model->getBlockSingleton($type));
}
示例2: testGetBlockSingleton
public function testGetBlockSingleton()
{
$block = $this->_layout->getBlockSingleton('Magento\\Framework\\View\\Element\\Text');
$this->assertInstanceOf('Magento\\Framework\\View\\Element\\Text', $block);
$this->assertSame($block, $this->_layout->getBlockSingleton('Magento\\Framework\\View\\Element\\Text'));
}
示例3: getBlockSingleton
/**
* {@inheritdoc}
*/
public function getBlockSingleton($type)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'getBlockSingleton');
if (!$pluginInfo) {
return parent::getBlockSingleton($type);
} else {
return $this->___callPlugins('getBlockSingleton', func_get_args(), $pluginInfo);
}
}