|
|
@@ -590,6 +590,38 @@ class HelperTest extends CakeTestCase {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * test assetUrl application
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testAssetUrl() {
|
|
|
+ $this->Helper->webroot = '';
|
|
|
+ $_timestamp = Configure::read('Asset.timestamp');
|
|
|
+
|
|
|
+ $result = $this->Helper->assetUrl(array(
|
|
|
+ 'controller' => 'js',
|
|
|
+ 'action' => 'post',
|
|
|
+ 'ext' => 'js'
|
|
|
+ ),
|
|
|
+ array('fullBase' => true)
|
|
|
+ );
|
|
|
+ $this->assertEquals('http://localhost/js/post.js', $result);
|
|
|
+
|
|
|
+ $result = $this->Helper->assetUrl('foo.jpg', array('pathPrefix' => 'img/'));
|
|
|
+ $this->assertEquals('img/foo.jpg', $result);
|
|
|
+
|
|
|
+ $result = $this->Helper->assetUrl('foo.jpg', array('fullBase' => true));
|
|
|
+ $this->assertEquals('http://localhost/foo.jpg', $result);
|
|
|
+
|
|
|
+ Configure::write('Asset.timestamp', 'force');
|
|
|
+
|
|
|
+ $result = $this->Helper->assetUrl('cake.generic.css', array('pathPrefix' => CSS_URL));
|
|
|
+ $this->assertRegExp('/' . preg_quote(CSS_URL . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
|
|
+
|
|
|
+ Configure::write('Asset.timestamp', $_timestamp);
|
|
|
+ }
|
|
|
+
|
|
|
+/**
|
|
|
* test assetTimestamp with plugins and themes
|
|
|
*
|
|
|
* @return void
|