예제 #1
0
파일: NewTest.php 프로젝트: relue/magento2
 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());
 }
예제 #2
0
 /**
  * @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();
 }