public function testToHtml() { $this->assertEmpty($this->_block->getProductCollection()); $this->_block->setProductsCount(5); $this->_block->setTemplate('product/widget/new/content/new_list.phtml'); $this->_block->setLayout(new Mage_Core_Model_Layout()); $html = $this->_block->toHtml(); $this->assertNotEmpty($html); $this->assertContains('New Product', $html); $this->assertInstanceOf('Mage_Catalog_Model_Resource_Product_Collection', $this->_block->getProductCollection()); }
/** * @param string $html * @param Mage_Catalog_Block_Product_New $block * @return string */ private function _processNewProducts($html, $block) { $helper = $this->_getHelper(); /** @var $processor Mageplace_Callforprice_Model_Htmlprocessor_Interface */ $processor = Mage::getModel('mageplace_callforprice/htmlprocessor_factory')->createProcessor(); $processor->load($html); if ($helper->isGlobalEnabled()) { $processor->replace($helper->getCssSelector('new_product_price'), $helper->prepareReplacement()); $processor->remove($helper->getCssSelector('new_product_addtocart')); return $processor->getHtml(); } $processor->process('new', array('products' => $block->getProductCollection())); return $processor->getHtml(); }