Skip to content

Commit

Permalink
Making view + helpers groups pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 28, 2010
1 parent dcb7a16 commit d8b2bcd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions cake/libs/view/helper.php
Expand Up @@ -164,6 +164,7 @@ class Helper extends Object {
public function __construct(View $View, $settings = array()) {
$this->_View = $View;
$this->params = $View->params;
$this->request = $View->request;
if (!empty($this->helpers)) {
$this->_helperMap = ObjectCollection::normalizeObjectArray($this->helpers);
}
Expand Down Expand Up @@ -722,13 +723,13 @@ public function value($options = array(), $field = null, $key = 'value') {
$data = $this->request->data;

$entity = $this->_View->entity();
if (!empty($this->data) && !empty($entity)) {
$result = Set::extract($this->data, join('.', $entity));
if (!empty($data) && !empty($entity)) {
$result = Set::extract($data, join('.', $entity));
}

$habtmKey = $this->field();
if (empty($result) && isset($data[$habtmKey][$habtmKey])) {
$result = $this->data[$habtmKey][$habtmKey];
$result = $data[$habtmKey][$habtmKey];
} elseif (empty($result) && isset($data[$habtmKey]) && is_array($data[$habtmKey])) {
if (ClassRegistry::isKeySet($habtmKey)) {
$model =& ClassRegistry::getObject($habtmKey);
Expand Down
7 changes: 3 additions & 4 deletions cake/tests/cases/libs/view/helpers/cache.test.php
Expand Up @@ -373,7 +373,7 @@ function testCacheWithNamedAndPassedArgs() {
Router::reload();

$this->Controller->cache_parsing();
$this->Controller->params = array(
$this->Controller->request->addParams(array(
'controller' => 'cache_test',
'action' => 'cache_parsing',
'url' => array(),
Expand All @@ -382,12 +382,11 @@ function testCacheWithNamedAndPassedArgs() {
'name' => 'mark',
'ice' => 'cream'
)
);
));
$this->Controller->cacheAction = array(
'cache_parsing' => 21600
);
$this->Controller->here = '/cache_test/cache_parsing/1/2/name:mark/ice:cream';
$this->Controller->action = 'cache_parsing';
$this->Controller->request->here = '/cache_test/cache_parsing/1/2/name:mark/ice:cream';

$View = new View($this->Controller);
$result = $View->render('index');
Expand Down
5 changes: 3 additions & 2 deletions cake/tests/cases/libs/view/view.test.php
Expand Up @@ -228,7 +228,8 @@ class ViewTest extends CakeTestCase {
function setUp() {
Router::reload();
$this->Controller = new Controller();
$this->PostsController = new ViewPostsController();
$request = $this->getMock('CakeRequest');
$this->PostsController = new ViewPostsController($request);
$this->PostsController->viewPath = 'posts';
$this->PostsController->index();
$this->View = new View($this->PostsController);
Expand Down Expand Up @@ -700,7 +701,7 @@ function testRenderLayoutWithMockCacheHelper() {
$_check = Configure::read('Cache.check');
Configure::write('Cache.check', true);

$Controller = new ViewPostsController();
$Controller = new ViewPostsController($this->getMock('CakeRequest'));
$Controller->cacheAction = '1 day';
$View = new View($Controller);
$View->helpers = array('Cache', 'Html', 'Session');
Expand Down

0 comments on commit d8b2bcd

Please sign in to comment.