Example #1
0
 /**
  * Create <N> sample blocks
  *
  * @param int $qty
  * @param bool $withLayout
  * @param string $className
  * @return array
  */
 protected function _createSampleBlocks($qty, $withLayout = true, $className = 'Mage_Core_Block_Template')
 {
     $blocks = array();
     $names = array();
     $layout = false;
     if ($withLayout) {
         $layout = new Mage_Core_Model_Layout();
     }
     for ($i = 0; $i < $qty; $i++) {
         $name = uniqid('block.');
         if ($layout) {
             $block = $layout->createBlock($className, $name);
             $layout->insertBlock('', $name, $name);
         } else {
             $block = new $className();
             $block->setNameInLayout($name);
         }
         $blocks[] = $block;
         $names[] = $name;
     }
     return array($blocks, $names);
 }