public function testGetBlockHtml() { // Without layout $block1 = new Mage_Core_Block_Text(); $block1->setText('Block text'); $block1->setNameInLayout('block'); $html = $this->_block->getBlockHtml('block'); $this->assertInternalType('string', $html); $this->assertEmpty($html); // With layout $expected = 'Block2'; $block2 = $this->_createBlockWithLayout('block2', 'block2', 'Mage_Core_Block_Text'); $block3 = $this->_createBlockWithLayout('block3', 'block3'); $block2->setText($expected); $html = $block3->getBlockHtml('block2'); $this->assertInternalType('string', $html); $this->assertEquals($expected, $html); }
public function testGetBlockHtml() { // Without layout /** @var $blockFactory Mage_Core_Model_BlockFactory */ $blockFactory = Mage::getObjectManager()->get('Mage_Core_Model_BlockFactory'); $block1 = $blockFactory->createBlock('Mage_Core_Block_Text'); $block1->setText('Block text'); $block1->setNameInLayout('block'); $html = $this->_block->getBlockHtml('block'); $this->assertInternalType('string', $html); $this->assertEmpty($html); // With layout $expected = 'Block2'; $block2 = $this->_createBlockWithLayout('block2', 'block2', 'Mage_Core_Block_Text'); $block3 = $this->_createBlockWithLayout('block3', 'block3'); $block2->setText($expected); $html = $block3->getBlockHtml('block2'); $this->assertInternalType('string', $html); $this->assertEquals($expected, $html); }