diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index 0b3283e47..1f4cd5e3e 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -350,7 +350,7 @@ class HtmlHelper extends AppHelper { if (strpos($path, '.css') === false) { $path .= '.css'; } - if (Configure::read('Asset.timestamp') == true && Configure::read() > 0) { + if ((Configure::read('Asset.timestamp') === true && Configure::read() > 0) || Configure::read('Asset.timestamp') === 'force') { $path .= '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $path)); } } diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php index 80d1a82f3..c99bbb414 100644 --- a/cake/libs/view/helpers/javascript.php +++ b/cake/libs/view/helpers/javascript.php @@ -189,7 +189,7 @@ class JavascriptHelper extends AppHelper { if (strpos($url, '.js') === false) { $url .= '.js'; } - if (Configure::read('Asset.timestamp') == true && Configure::read() > 0) { + if ((Configure::read('Asset.timestamp') === true && Configure::read() > 0) || Configure::read('Asset.timestamp') === 'force') { $url .= '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $url)); } } diff --git a/cake/tests/cases/libs/view/helpers/html.test.php b/cake/tests/cases/libs/view/helpers/html.test.php index 4174ffcab..854bca6f4 100644 --- a/cake/tests/cases/libs/view/helpers/html.test.php +++ b/cake/tests/cases/libs/view/helpers/html.test.php @@ -122,7 +122,18 @@ class HtmlHelperTest extends UnitTestCase { Configure::write('Asset.timestamp', true); $result = $this->Html->css('cake.generic'); $this->assertPattern('/^]+href=".*css\/cake\.generic\.css\?[0-9]+"[^<>]+\/>$/', $result); + + $debug = Configure::read('debug'); + Configure::write('debug', 0); + $result = $this->Html->css('cake.generic'); + $this->assertPattern('/^]+href=".*css\/cake\.generic\.css"[^<>]+\/>$/', $result); + + Configure::write('Asset.timestamp', 'force'); + $result = $this->Html->css('cake.generic'); + $this->assertPattern('/^]+href=".*css\/cake\.generic\.css\?[0-9]+"[^<>]+\/>$/', $result); + Configure::write('Asset.timestamp', false); + Configure::write('debug', $debug); Configure::write('Asset.filter.css', 'css.php'); $result = $this->Html->css('cake.generic'); diff --git a/cake/tests/cases/libs/view/helpers/javascript.test.php b/cake/tests/cases/libs/view/helpers/javascript.test.php index c83a8e414..36d32df50 100644 --- a/cake/tests/cases/libs/view/helpers/javascript.test.php +++ b/cake/tests/cases/libs/view/helpers/javascript.test.php @@ -74,6 +74,18 @@ class JavascriptTest extends UnitTestCase { Configure::write('Asset.timestamp', true); $result = $this->Javascript->link('jquery-1.1.2'); $this->assertPattern('/^]+src=".*js\/jquery-1\.1\.2\.js\?"[^<>]*>/', $result); + + $debug = Configure::read('debug'); + Configure::write('debug', 0); + $result = $this->Javascript->link('jquery-1.1.2'); + $expected = ''; + $this->assertEqual($result, $expected); + + Configure::write('Asset.timestamp', 'force'); + $result = $this->Javascript->link('jquery-1.1.2'); + $this->assertPattern('/^]+src=".*js\/jquery-1\.1\.2\.js\?"[^<>]*>/', $result); + + Configure::write('debug', $debug); Configure::write('Asset.timestamp', false); Configure::write('Asset.filter.js', 'js.php');