Skip to content

Commit

Permalink
Adding test case for HtmlHelper::url() showing use of key 'full_base'…
Browse files Browse the repository at this point in the history
… for parameter. Refs #627
  • Loading branch information
ADmad committed Apr 26, 2010
1 parent af6435e commit c2bd871
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions cake/tests/cases/libs/view/helpers/html.test.php
Expand Up @@ -20,6 +20,10 @@
App::import('Core', array('Helper', 'AppHelper', 'ClassRegistry', 'Controller', 'Model'));
App::import('Helper', array('Html', 'Form'));

if (!defined('FULL_BASE_URL')) {
define('FULL_BASE_URL', 'http://cakephp.org');
}

/**
* TheHtmlTestController class
*
Expand Down Expand Up @@ -157,6 +161,10 @@ function testLink() {
$expected = array('a' => array('href' => '/home'), 'preg:/\/home/', '/a');
$this->assertTags($result, $expected);

$result = $this->Html->link('Posts', array('controller' => 'posts', 'action' => 'index', 'full_base' => true));
$expected = array('a' => array('href' => FULL_BASE_URL . '/posts'), 'Posts', '/a');
$this->assertTags($result, $expected);

$result = $this->Html->link('Home', '/home', array('confirm' => 'Are you sure you want to do this?'));
$expected = array(
'a' => array('href' => '/home', 'onclick' => 'return confirm('Are you sure you want to do this?');'),
Expand Down Expand Up @@ -358,18 +366,18 @@ function testImageTagWithTheme() {
$webroot = $this->Html->webroot;
$this->Html->webroot = '/testing/';
$result = $this->Html->image('__cake_test_image.gif');

$this->assertTags($result, array(
'img' => array(
'src' => 'preg:/\/testing\/theme\/test_theme\/img\/__cake_test_image\.gif\?\d+/',
'alt' => ''
)));
$this->Html->webroot = $webroot;

$dir =& new Folder(WWW_ROOT . 'theme' . DS . 'test_theme');
$dir->delete();
}

/**
* test theme assets in main webroot path
*
Expand All @@ -383,7 +391,7 @@ function testThemeAssetsInMainWebrootPath() {
));
$webRoot = Configure::read('App.www_root');
Configure::write('App.www_root', TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'webroot' . DS);

$webroot = $this->Html->webroot;
$this->Html->theme = 'test_theme';
$result = $this->Html->css('webroot_test');
Expand All @@ -399,7 +407,7 @@ function testThemeAssetsInMainWebrootPath() {
'link' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'preg:/.*theme\/test_theme\/css\/theme_webroot\.css/')
);
$this->assertTags($result, $expected);

Configure::write('App.www_root', $webRoot);
}

Expand Down

0 comments on commit c2bd871

Please sign in to comment.