mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,21 +28,21 @@ App::import('Core', array('Helper', 'AppHelper', 'ClassRegistry', 'Controller',
|
|||
App::import('Helper', array('Html', 'Form'));
|
||||
/**
|
||||
* TheHtmlTestController class
|
||||
*
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
*/
|
||||
class TheHtmlTestController extends Controller {
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
*
|
||||
* @var string 'TheTest'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'TheTest';
|
||||
/**
|
||||
* uses property
|
||||
*
|
||||
*
|
||||
* @var mixed null
|
||||
* @access public
|
||||
*/
|
||||
|
@ -50,21 +50,21 @@ class TheHtmlTestController extends Controller {
|
|||
}
|
||||
/**
|
||||
* HtmlHelperTest class
|
||||
*
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
*/
|
||||
class HtmlHelperTest extends CakeTestCase {
|
||||
/**
|
||||
* html property
|
||||
*
|
||||
*
|
||||
* @var mixed null
|
||||
* @access public
|
||||
*/
|
||||
var $html = null;
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -75,7 +75,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testDocType method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -92,7 +92,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testLink method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -167,7 +167,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testImageTag method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -191,7 +191,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testStyle method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -207,7 +207,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testCssLink method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -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);
|
||||
|
||||
|
@ -263,7 +279,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testCharsetTag method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -281,7 +297,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testBreadcrumb method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -350,7 +366,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testNestedList method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -617,7 +633,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testMeta method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -630,7 +646,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Html->meta('atom', array('controller' => 'posts', 'ext' => 'xml'));
|
||||
$this->assertTags($result, array('link' => array('href' => 'preg:/.*\/posts\.xml/', 'type' => 'application/atom+xml', 'title' => 'atom')));
|
||||
|
||||
|
||||
$result = $this->Html->meta('non-existing');
|
||||
$this->assertTags($result, array('<meta'));
|
||||
|
||||
|
@ -673,7 +689,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testTableHeaders method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -684,7 +700,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testTableCells method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -725,7 +741,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'/tr'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
|
||||
$tr = array(
|
||||
array('td content 1', 'td content 2', 'td content 3'),
|
||||
array('td content 1', 'td content 2', 'td content 3'),
|
||||
|
@ -734,7 +750,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$result = $this->Html->tableCells($tr, array('class' => 'odd'), array('class' => 'even'));
|
||||
$expected = "<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>";
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
$tr = array(
|
||||
array('td content 1', 'td content 2', 'td content 3'),
|
||||
array('td content 1', 'td content 2', 'td content 3'),
|
||||
|
@ -744,7 +760,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$result = $this->Html->tableCells($tr, array('class' => 'odd'), array('class' => 'even'));
|
||||
$expected = "<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"odd\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>\n<tr class=\"even\"><td>td content 1</td> <td>td content 2</td> <td>td content 3</td></tr>";
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
$tr = array(
|
||||
array('td content 1', 'td content 2', 'td content 3'),
|
||||
array('td content 1', 'td content 2', 'td content 3'),
|
||||
|
@ -757,7 +773,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testTag method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -776,7 +792,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* testDiv method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -793,7 +809,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
|
||||
/**
|
||||
* testPara method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -809,7 +825,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
}
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue