/**
  * @loadFixture
  * @test
  */
 public function checkVersionOnUnmergedJsFiles()
 {
     $this->assertEquals('1', Mage::getStoreConfig('dev/js/addTstampToJsFiles'));
     $headBlock = new Mage_Page_Block_Html_Head();
     $headBlock->addItem('skin_js', 'js/opcheckout.js');
     $html = $headBlock->getCssJsHtml();
     $this->assertNotContains('js/opcheckout.js', $html);
     $this->assertRegExp('/[0-9]{10}\\.js/', $html);
     $this->assertRegExp('/js\\/opcheckout\\.[0-9]{10}\\.js/', $html);
 }
示例#2
0
 /**
  * @loadFixture
  * @test
  */
 public function defaultMergeJs()
 {
     $this->assertEquals('0', Mage::getStoreConfig('dev/js/addTstampToJsFiles'));
     $headBlock = new Mage_Page_Block_Html_Head();
     $headBlock->addItem('skin_js', 'js/opcheckout.js');
     $html = $headBlock->getCssJsHtml();
     $this->assertNotContains('js/opcheckout.js', $html);
     $matches = array();
     $result = preg_match('/\\/media\\/js\\/[u|s]\\.[a-f0-9]{32}\\.[0-9]{10}\\.js/', $html, $matches);
     $this->assertEquals(1, $result);
     $file = Mage::getBaseDir() . $matches[0];
     $this->assertTrue(file_exists($file));
     $this->assertContains('/* FILE: opcheckout.js */', file_get_contents($file));
 }
示例#3
0
 /**
  * Functionality @see Mage_Page_Block_Html_Head
  * Adds to parameters to influence the ordering
  *
  * @param string $type @see Mage_Page_Block_Html_Head
  * @param string $name @see Mage_Page_Block_Html_Head
  * @param null $params @see Mage_Page_Block_Html_Head
  * @param null $if @see Mage_Page_Block_Html_Head
  * @param null $cond @see Mage_Page_Block_Html_Head
  * @param string $referenceName name of the item to insert the element before. If name is not found, insert at the end, * has special meaning (before all / before all)
  * @param bool $before If true insert before the $referenceName instead of after
  * @return N98_LayoutHelper_Block_Page_Html_Head
  */
 public function addItem($type, $name, $params = null, $if = null, $cond = null, $referenceName = "*", $before = false)
 {
     // allow skipping of parameters in the layout XML files via empty-string
     if ($params == '') {
         $params = null;
     }
     if ($if == '') {
         $if = null;
     }
     if ($cond == '') {
         $cond = null;
     }
     parent::addItem($type, $name, $params, $if, $cond);
     // that is the standard behaviour
     if ($referenceName == '*' && $before == false) {
         return $this;
     }
     $this->_sortItems($referenceName, $before, $type);
     return $this;
 }
示例#4
0
 /**
  * Add HEAD External Item
  *
  * Allowed types:
  *  - js
  *  - js_css
  *  - skin_js
  *  - skin_css
  *  - rss
  *
  * @param string $type
  * @param string $name
  * @param string $params
  * @param string $if
  * @param string $cond
  * @return Mage_Page_Block_Html_Head
  */
 public function addExternalItem($type, $name, $params = null, $if = null, $cond = null)
 {
     parent::addItem($type, $name, $params = null, $if = null, $cond = null);
 }