Fixed test case for normalizeFindParams

Slightly refactored normalizeFindParams

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6017 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
the_undefined 2007-11-17 23:31:15 +00:00
parent f9e8e82b5b
commit 266d7ba738
2 changed files with 6 additions and 9 deletions

View file

@ -2082,11 +2082,8 @@ class Model extends Overloadable {
if (!empty($children)) {
if ($_this->name == $name) {
$tmp = $this->normalizeFindParams($type, $children, @$r[$name]);
$tmp = Set::merge($tmp, array($name => $r));
$r = am($r, $tmp[$name]);
$r = am($r, $this->normalizeFindParams($type, $children, $r, $_this));
} else {
//$r['_self'] = $name;
$r[$name] = $this->normalizeFindParams($type, $children, @$r[$name], $_this->{$name});;
}
} else {

View file

@ -464,14 +464,14 @@ class ModelTest extends CakeTestCase {
$this->model =& new Article();
$result = $this->model->normalizeFindParams('fields', array(
'title', 'body', 'published', 'Article.id',
'User', 'Comment.id', 'Comment.comment', 'Comment.User.password', 'Comment.Article',
'Tag' => array('id', 'tag'))
'title', 'body', 'published',
'Article.id', 'User', 'Comment.id', 'Comment.comment', 'Comment.User.password', 'Comment.Article',
'Tag' => array('id', 'tag')
)
);
$expected = array(
'Article' => array(
'fields' => array('id', 'title', 'body', 'published'),
'fields' => array('title', 'body', 'published', 'id'),
'User' => array('fields' => null),
'Comment' => array(
'fields' => array('id', 'comment'),