Skip to content

Commit

Permalink
Merge branch '1.3' into 1.3-misc
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Nov 11, 2009
2 parents f5cfab7 + db526dd commit c5a4191
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
* 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'),
* 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'),
* 'controllers' => array(/full/path/to/controllers/', '/next/full/path/to/controllers/'),
* 'controllers' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'),
* 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'),
* 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'),
* 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'),
Expand Down
Empty file removed app/tmp/cache/views/empty
Empty file.
4 changes: 2 additions & 2 deletions cake/console/libs/tasks/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class ModelTask extends Shell {
* @access public
*/
function execute() {
App::import('Model', 'Model', false);

if (empty($this->args)) {
$this->__interactive();
}
Expand Down Expand Up @@ -165,8 +167,6 @@ function inOptions($options, $prompt = null, $default = null) {
* @access private
*/
function __interactive() {
App::import('Model', 'Model', false);

$this->hr();
$this->out(sprintf("Bake Model\nPath: %s", $this->path));
$this->hr();
Expand Down
2 changes: 1 addition & 1 deletion cake/console/libs/tasks/project.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function corePath($path) {
$File =& new File($path . 'webroot' . DS . 'test.php');
$contents = $File->read();
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
$result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', ". (strpos(CAKE_CORE_INCLUDE_PATH, '/')===0? " DS . '":"'") . str_replace('/', '\' . DS . \'', trim(CAKE_CORE_INCLUDE_PATH, '/')) . "');", $contents);
$result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', " . $root . str_replace(DS, "' . DS . '", trim(CAKE_CORE_INCLUDE_PATH, DS)) . "');", $contents);
if (!$File->write($result)) {
return false;
}
Expand Down
4 changes: 3 additions & 1 deletion cake/libs/view/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,9 @@ function value($options = array(), $field = null, $key = 'value') {
}

$habtmKey = $this->field();
if (empty($result) && isset($this->data[$habtmKey]) && is_array($this->data[$habtmKey])) {
if (empty($result) && isset($this->data[$habtmKey][$habtmKey])) {
$result = $this->data[$habtmKey][$habtmKey];
} elseif (empty($result) && isset($this->data[$habtmKey]) && is_array($this->data[$habtmKey])) {
if (ClassRegistry::isKeySet($habtmKey)) {
$model =& ClassRegistry::getObject($habtmKey);
$result = $this->__selectedArray($this->data[$habtmKey], $model->primaryKey);
Expand Down
4 changes: 4 additions & 0 deletions cake/tests/cases/console/libs/tasks/project.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ function testIndexPhpGeneration() {
$file =& new File($path . 'webroot' . DS . 'index.php');
$contents = $file->read();
$this->assertNoPattern('/define\(\'CAKE_CORE_INCLUDE_PATH\', \'ROOT/', $contents);

$file =& new File($path . 'webroot' . DS . 'test.php');
$contents = $file->read();
$this->assertNoPattern('/define\(\'CAKE_CORE_INCLUDE_PATH\', \'ROOT/', $contents);
}

/**
Expand Down
20 changes: 20 additions & 0 deletions cake/tests/cases/libs/view/helper.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,26 @@ function testValue() {
$this->Helper->setEntity('Post.2.created.year');
$result = $this->Helper->value('Post.2.created.year');
$this->assertEqual($result, '2008');

$this->Helper->data = array('HelperTestTag' => array('HelperTestTag' => ''));
$this->Helper->setEntity('HelperTestTag.HelperTestTag');
$result = $this->Helper->value('HelperTestTag.HelperTestTag');
$this->assertEqual($result, '');

$this->Helper->data = array('HelperTestTag' => array('HelperTestTag' => array(2, 3, 4)));
$this->Helper->setEntity('HelperTestTag.HelperTestTag');
$result = $this->Helper->value('HelperTestTag.HelperTestTag');
$this->assertEqual($result, array(2, 3, 4));

$this->Helper->data = array(
'HelperTestTag' => array(
array('id' => 3),
array('id' => 5)
)
);
$this->Helper->setEntity('HelperTestTag.HelperTestTag');
$result = $this->Helper->value('HelperTestTag.HelperTestTag');
$this->assertEqual($result, array(3 => 3, 5 => 5));
}

/**
Expand Down

0 comments on commit c5a4191

Please sign in to comment.