public function testCombine() { $combiner = new CombineAssets(); $url = $combiner->combine(['assets/css/style1.css', 'assets/css/style2.css'], '/tests/fixtures/Cms/themes/test'); $this->assertNotNull($url); $this->assertRegExp('/\\w+[-]\\d+/i', $url); // Must contain hash-number $url = $combiner->combine(['assets/js/script1.js', 'assets/js/script2.js'], '/tests/fixtures/Cms/themes/test'); $this->assertNotNull($url); $this->assertRegExp('/\\w+[-]\\d+/i', $url); // Must contain hash-number }
/** * Converts supplied URL to a theme URL relative to the website root. If the URL provided is an * array then the files will be combined. * @param mixed $url Specifies the theme-relative URL. If null, the theme path is returned. * @return string */ public function themeUrl($url = null) { $themePath = Config::get('cms.themesDir') . '/' . $this->getTheme()->getDirName(); if (is_array($url)) { $_url = Request::getBaseUrl(); $_url .= CombineAssets::combine($url, $themePath); } else { $_url = Request::getBasePath() . $themePath; if ($url !== null) { $_url .= '/' . $url; } } return $_url; }