public function testAddBlock() { $this->assertInstanceOf('Mage_Core_Block_Text', $this->_layout->addBlock('Mage_Core_Block_Text', 'block1')); $block2 = new Mage_Core_Block_Text(); $block2->setNameInLayout('block2'); $this->_layout->addBlock($block2, '', 'block1'); $this->assertTrue($this->_layout->hasElement('block1')); $this->assertTrue($this->_layout->hasElement('block2')); $this->assertEquals('block1', $this->_layout->getParentName('block2')); }
public function testGetCacheKey() { $name = uniqid('block.'); $block = new Mage_Core_Block_Text(); $block->setNameInLayout($name); $key = $block->getCacheKey(); $this->assertNotEmpty($key); $this->assertNotEquals('key', $key); $this->assertNotEquals($name, $key); $block->setCacheKey('key'); $this->assertEquals('key', $block->getCacheKey()); }