mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 15:39:53 +00:00
Fixing issue where double call to webroot on HtmlHelper::css was generating wrong URLs when forcing asset timestamp, fixes #5723
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7843 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
8da2a5208f
commit
8777b8ef96
2 changed files with 41 additions and 26 deletions
|
@ -347,7 +347,6 @@ class HtmlHelper extends AppHelper {
|
|||
$path .= '.css';
|
||||
}
|
||||
if ((Configure::read('Asset.timestamp') === true && Configure::read() > 0) || Configure::read('Asset.timestamp') === 'force') {
|
||||
$path = $this->webroot($path);
|
||||
$path .= '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $path));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -236,15 +236,31 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
|
||||
$debug = Configure::read('debug');
|
||||
Configure::write('debug', 0);
|
||||
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/.*css\/cake\.generic\.css/';
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
Configure::write('Asset.timestamp', 'force');
|
||||
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/.*css\/cake\.generic\.css\?[0-9]+/';
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$webroot = $this->Html->webroot;
|
||||
$this->Html->webroot = '/testing/';
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/\/testing\/css\/cake\.generic\.css\?[0-9]+/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->Html->webroot = $webroot;
|
||||
|
||||
$webroot = $this->Html->webroot;
|
||||
$this->Html->webroot = '/testing/longer/';
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/\/testing\/longer\/css\/cake\.generic\.css\?[0-9]+/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->Html->webroot = $webroot;
|
||||
|
||||
Configure::write('Asset.timestamp', false);
|
||||
Configure::write('debug', $debug);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue