Skip to content
Permalink
Browse files

Adding an additional test for View::entity().

Fixing issue where nulls would be shifted onto the entity array causing incorrect name attributes.  Fixes #867
  • Loading branch information...
markstory committed Jun 29, 2010
1 parent f11f9eb commit 94965f0f6c1bbe30229de82881e9aaa5576a79a4
Showing with 10 additions and 2 deletions.
  1. +2 −2 cake/libs/view/view.php
  2. +8 −0 cake/tests/cases/libs/view/view.test.php
@@ -629,9 +629,9 @@ function entity() {
($count == 1 && !empty($this->association)) ||
($count == 1 && $this->model != $this->entityPath) ||
($count == 2 && !empty($this->fieldSuffix)) ||
is_numeric($path[0])
is_numeric($path[0]) && !empty($assoc)
) {
array_unshift($path,$assoc);
array_unshift($path, $assoc);
}
return Set::filter($path);
}
@@ -891,6 +891,14 @@ function testEntityReference() {
$View->association = 'Comment';
$View->field = 'user_id';
$this->assertEqual($View->entity(), array('Comment', 'user_id'));
$View->model = 0;
$View->association = null;
$View->field = 'Node';
$View->fieldSuffix = 'title';
$View->entityPath = '0.Node.title';
$expected = array(0, 'Node', 'title');
$this->assertEqual($View->entity(), $expected);
}
/**

0 comments on commit 94965f0

Please sign in to comment.
You can’t perform that action at this time.