diff --git a/lib/Cake/Test/Case/View/JsonViewTest.php b/lib/Cake/Test/Case/View/JsonViewTest.php index 39a3e7a1d..ed2b04e4e 100644 --- a/lib/Cake/Test/Case/View/JsonViewTest.php +++ b/lib/Cake/Test/Case/View/JsonViewTest.php @@ -76,6 +76,7 @@ class JsonViewTest extends CakeTestCase { 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) )); $Request = new CakeRequest(); + $Request->params['named'] = array('page' => 2); $Response = new CakeResponse(); $Controller = new Controller($Request, $Response); $Controller->name = $Controller->viewPath = 'Posts'; @@ -91,9 +92,10 @@ class JsonViewTest extends CakeTestCase { ); $Controller->set('user', $data); $View = new JsonView($Controller); + $View->helpers = array('Paginator'); $output = $View->render('index'); - $expected = json_encode(array('user' => 'fake', 'list' => array('item1', 'item2'))); + $expected = json_encode(array('user' => 'fake', 'list' => array('item1', 'item2'), 'paging' => array('page' => 2))); $this->assertSame($expected, $output); $this->assertSame('application/json', $Response->type()); } diff --git a/lib/Cake/Test/test_app/View/Posts/json/index.ctp b/lib/Cake/Test/test_app/View/Posts/json/index.ctp index 433162d58..f2d423459 100644 --- a/lib/Cake/Test/test_app/View/Posts/json/index.ctp +++ b/lib/Cake/Test/test_app/View/Posts/json/index.ctp @@ -16,9 +16,12 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ +$paging = isset($this->Paginator->options['url']) ? $this->Paginator->options['url'] : null; + $formatted = array( 'user' => $user['User']['username'], - 'list' => array() + 'list' => array(), + 'paging' => $paging, ); foreach ($user['Item'] as $item) { $formatted['list'][] = $item['name']; diff --git a/lib/Cake/View/JsonView.php b/lib/Cake/View/JsonView.php index 188c29d1e..f88cc678a 100644 --- a/lib/Cake/View/JsonView.php +++ b/lib/Cake/View/JsonView.php @@ -85,12 +85,7 @@ class JsonView extends View { return $this->_serialize($this->viewVars['_serialize']); } if ($view !== false && $viewFileName = $this->_getViewFileName($view)) { - if (!$this->_helpersLoaded) { - $this->loadHelpers(); - } - $content = $this->_render($viewFileName); - $this->Blocks->set('content', $content); - return $content; + return parent::render($view, false); } } diff --git a/lib/Cake/View/XmlView.php b/lib/Cake/View/XmlView.php index 9b81066ba..7e757b54c 100644 --- a/lib/Cake/View/XmlView.php +++ b/lib/Cake/View/XmlView.php @@ -88,12 +88,7 @@ class XmlView extends View { return $this->_serialize($this->viewVars['_serialize']); } if ($view !== false && $viewFileName = $this->_getViewFileName($view)) { - if (!$this->_helpersLoaded) { - $this->loadHelpers(); - } - $content = $this->_render($viewFileName); - $this->Blocks->set('content', (string)$content); - return $content; + return parent::render($view, false); } }