public function testContentBundle() { $this->Asset = JsAsset::fromUrl('js/bundle.js', $this->path); $expected = <<<EOT document.write('<script src="/asset/js/default-e4d6bff70072c8553794a4ba4daca1de.js"></script>'); var Bundle = {}; EOT; $this->assertEquals($expected, $this->Asset->content()); }
public function fromUrl($url, $env = null) { $info = pathinfo($url); if ($info['extension'] == 'css') { return CssAsset::fromUrl($url, $env); } if ($info['extension'] == 'js') { return JsAsset::fromUrl($url, $env); } return StaticAsset::fromUrl($url, $env); }
/** * @param JsAsset $asset * @return mixed * @throws HelperMethodNotFoundException */ public function renderJs(JsAsset $asset) { $helper = $this->helpers[$this->assetTypes['js']['helper']]; if (!is_a($helper, 'Helper') || !method_exists($helper, 'script')) { throw new HelperMethodNotFoundException(); } return $helper->script($asset->getPath(), array('inline' => TRUE)); }