本文整理汇总了PHP中Mage_Core_Model_Layout::getAllBlocks方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Layout::getAllBlocks方法的具体用法?PHP Mage_Core_Model_Layout::getAllBlocks怎么用?PHP Mage_Core_Model_Layout::getAllBlocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Layout
的用法示例。
在下文中一共展示了Mage_Core_Model_Layout::getAllBlocks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGenerateXmlAndBlocks
/**
* @covers Mage_Core_Model_Layout::getAllBlocks
* @covers Mage_Core_Model_Layout::generateBlocks
* @covers Mage_Core_Model_Layout::getBlock
*/
public function testGenerateXmlAndBlocks()
{
$this->_model->generateXml();
/* Generate fixture
file_put_contents(__DIR__ . '/_files/_layout_update.xml', $this->_model->getNode()->asNiceXml());
*/
$this->assertXmlStringEqualsXmlFile(__DIR__ . '/_files/_layout_update.xml', $this->_model->getXmlString());
$this->assertEquals(array(), $this->_model->getAllBlocks());
$expectedBlocks = array('root', 'head', 'head.calendar', 'notifications', 'notification_baseurl', 'cache_notifications', 'notification_survey', 'notification_security', 'messages', 'index_notifications', 'index_notifications_copy');
$this->_model->generateBlocks();
$actualBlocks = $this->_model->getAllBlocks();
$this->assertEquals($expectedBlocks, array_keys($actualBlocks));
/** @var $block Mage_Adminhtml_Block_Page_Head */
$block = $this->_model->getBlock('head');
$this->assertEquals('Magento Admin', $block->getTitle());
$block = $this->_model->getBlock('head.calendar');
$this->assertSame($this->_model->getBlock('head'), $block->getParentBlock());
/** @var $block Mage_Core_Block_Template */
$block = $this->_model->getBlock('root');
$this->assertEquals('popup.phtml', $block->getTemplate());
}