public function testScriptsRespectCacheBustOption() { $tagger = new Tagger(); $tag = $tagger->getScriptTag('myscript.js', "text"); $this->assertEquals('<script type="text/javascript" src="myscript.js?cb=text"></script>', $tag, 'Tagger should contain end of lines by default'); $tagger->cacheBustKey = 'mtime'; $tag = $tagger->getScriptTag('myscript.js', 123); $this->assertEquals('<script type="text/javascript" src="myscript.js?mtime=123"></script>', $tag, 'Tagger should not contain end of lines by default'); }
public function testGetScriptTag() { $tagger = new Tagger(); $tag = $tagger->getScriptTag('myscript.js'); $this->assertEquals('<script type="text/javascript" src="myscript.js"></script>', $tag, 'Tagger should convert filepath to script tag pointing to file path'); $tag = $tagger->getScriptTag('some/path/myscript.js'); $this->assertEquals('<script type="text/javascript" src="some/path/myscript.js"></script>', $tag, 'Tagger should convert filepath to script tag pointing to file path'); $tag = $tagger->getScriptTag('http://www.somewhere.com/js/myscript.js'); $this->assertEquals('<script type="text/javascript" src="http://www.somewhere.com/js/myscript.js"></script>', $tag, 'Tagger should convert filepath to script tag pointing to file path'); }
public function testScriptsRespectEndOfLineOption() { $tagger = new Tagger(); $tag = $tagger->getScriptTag('myscript.js'); $this->assertEquals('<script type="text/javascript" src="myscript.js"></script>', $tag, 'Tagger should not contain end of lines by default'); $tagger->includingEndOfLine = true; $tag = $tagger->getScriptTag('myscript.js'); $this->assertEquals('<script type="text/javascript" src="myscript.js"></script>' . PHP_EOL, $tag, 'Tagger should contain end of lines by default'); $tagger->includingEndOfLine = false; $tag = $tagger->getScriptTag('myscript.js'); $this->assertEquals('<script type="text/javascript" src="myscript.js"></script>', $tag, 'Tagger should respect flag when toggled'); }