diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php index adc90c067..d0ab0d8c7 100644 --- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php @@ -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');