コード例 #1
0
ファイル: LayoutTest.php プロジェクト: nayanchamp/magento2
 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'));
 }
コード例 #2
0
ファイル: AbstractTest.php プロジェクト: nemphys/magento2
 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());
 }