mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Added test for relative path using app asset configuration
This commit is contained in:
parent
db6d0a748b
commit
cda1a1e6c9
1 changed files with 25 additions and 0 deletions
|
@ -400,6 +400,9 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$result = $this->Html->image('http://google.com/logo.gif');
|
||||
$this->assertTags($result, array('img' => array('src' => 'http://google.com/logo.gif', 'alt' => '')));
|
||||
|
||||
$result = $this->Html->image('//google.com/logo.gif');
|
||||
$this->assertTags($result, array('img' => array('src' => '//google.com/logo.gif', 'alt' => '')));
|
||||
|
||||
$result = $this->Html->image(array('controller' => 'test', 'action' => 'view', 1, 'ext' => 'gif'));
|
||||
$this->assertTags($result, array('img' => array('src' => '/test/view/1.gif', 'alt' => '')));
|
||||
|
||||
|
@ -417,6 +420,12 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Html->image('test.gif', array('pathPrefix' => '//cakephp.org/assets/img/'));
|
||||
$this->assertTags($result, array('img' => array('src' => '//cakephp.org/assets/img/test.gif', 'alt' => '')));
|
||||
|
||||
$previousConfig = Configure::read('App.imageBaseUrl');
|
||||
Configure::write('App.imageBaseUrl', '//cdn.cakephp.org/img/');
|
||||
$result = $this->Html->image('test.gif');
|
||||
$this->assertTags($result, array('img' => array('src' => '//cdn.cakephp.org/img/test.gif', 'alt' => '')));
|
||||
Configure::write('App.imageBaseUrl', $previousConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -610,6 +619,13 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$expected['link']['href'] = 'http://cakephp.org/assets/css/cake.generic.css';
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$previousConfig = Configure::read('App.cssBaseUrl');
|
||||
Configure::write('App.cssBaseUrl', '//cdn.cakephp.org/css/');
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = '//cdn.cakephp.org/css/cake.generic.css';
|
||||
$this->assertTags($result, $expected);
|
||||
Configure::write('App.cssBaseUrl', $previousConfig);
|
||||
|
||||
Configure::write('Asset.filter.css', 'css.php');
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/.*ccss\/cake\.generic\.css/';
|
||||
|
@ -955,6 +971,15 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$previousConfig = Configure::read('App.jsBaseUrl');
|
||||
Configure::write('App.jsBaseUrl', '//cdn.cakephp.org/js/');
|
||||
$result = $this->Html->script('foo4');
|
||||
$expected = array(
|
||||
'script' => array('type' => 'text/javascript', 'src' => '//cdn.cakephp.org/js/foo4.js')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
Configure::write('App.jsBaseUrl', $previousConfig);
|
||||
|
||||
$result = $this->Html->script('foo');
|
||||
$this->assertNull($result, 'Script returned upon duplicate inclusion %s');
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue