From 93b80042f8fc24fcc550a9db9600a5bc42d30a80 Mon Sep 17 00:00:00 2001 From: predominant Date: Sat, 28 Aug 2010 15:01:43 +1000 Subject: [PATCH 1/4] Fix failing scaffold tests. --- cake/tests/cases/libs/controller/scaffold.test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cake/tests/cases/libs/controller/scaffold.test.php b/cake/tests/cases/libs/controller/scaffold.test.php index 100ed67b8..1d08a91de 100644 --- a/cake/tests/cases/libs/controller/scaffold.test.php +++ b/cake/tests/cases/libs/controller/scaffold.test.php @@ -789,7 +789,7 @@ class ScaffoldTest extends CakeTestCase { $this->Controller->theme = 'test_theme'; $this->Controller->view = 'Theme'; $this->Controller->constructClasses(); - $Scaffold =& new TestScaffoldMock($this->Controller, array()); + $Scaffold =& new TestScaffoldMock($this->Controller, new CakeRequest()); $this->assertEqual($this->Controller->view, 'Scaffold'); } From c1209a1a7a0b47e9d5a20dd61bec208afd4d642a Mon Sep 17 00:00:00 2001 From: predominant Date: Sat, 28 Aug 2010 15:15:23 +1000 Subject: [PATCH 2/4] Added RequestObject output in place of Controller:$output whicch no longer exists. --- cake/tests/cases/libs/controller/pages_controller.test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cake/tests/cases/libs/controller/pages_controller.test.php b/cake/tests/cases/libs/controller/pages_controller.test.php index c913192d4..e61ba2018 100644 --- a/cake/tests/cases/libs/controller/pages_controller.test.php +++ b/cake/tests/cases/libs/controller/pages_controller.test.php @@ -60,12 +60,12 @@ class PagesControllerTest extends CakeTestCase { $Pages->viewPath = 'posts'; $Pages->display('index'); - $this->assertPattern('/posts index/', $Pages->output); + $this->assertPattern('/posts index/', $Pages->getResponse()->body()); $this->assertEqual($Pages->viewVars['page'], 'index'); $Pages->viewPath = 'themed'; $Pages->display('test_theme', 'posts', 'index'); - $this->assertPattern('/posts index themed view/', $Pages->output); + $this->assertPattern('/posts index themed view/', $Pages->getResponse()->body()); $this->assertEqual($Pages->viewVars['page'], 'test_theme'); $this->assertEqual($Pages->viewVars['subpage'], 'posts'); } From f7addabcf2ff4b882406cc2444378061bd39c31d Mon Sep 17 00:00:00 2001 From: predominant Date: Sat, 28 Aug 2010 15:27:12 +1000 Subject: [PATCH 3/4] Whitespace removal --- cake/libs/controller/components/request_handler.php | 1 - 1 file changed, 1 deletion(-) diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index 917f42ad8..6b69bde6a 100644 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -480,7 +480,6 @@ class RequestHandlerComponent extends Component { return ($types[0] == $accepts[0]); } - $intersect = array_values(array_intersect($accepts, $types)); if (empty($intersect)) { return false; From 04d3353ee4e0c1ca617fe185fa496eee9754843e Mon Sep 17 00:00:00 2001 From: predominant Date: Sat, 28 Aug 2010 15:38:48 +1000 Subject: [PATCH 4/4] Adding access specifiers to methods --- cake/libs/controller/components/request_handler.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index 6b69bde6a..6418ab3d5 100644 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -392,10 +392,9 @@ class RequestHandlerComponent extends Component { * types the client accepts. If a string is passed, returns true * if the client accepts it. If an array is passed, returns true * if the client accepts one or more elements in the array. - * @access public * @see RequestHandlerComponent::setContent() */ - function accepts($type = null) { + public function accepts($type = null) { $accepted = $this->request->accepts(); if ($type == null) { @@ -455,10 +454,9 @@ class RequestHandlerComponent extends Component { * 'html', 'xml', 'js', etc. * @return mixed If $type is null or not provided, the first content-type in the * list, based on preference, is returned. - * @access public * @see RequestHandlerComponent::setContent() */ - function prefers($type = null) { + public function prefers($type = null) { $accepts = $this->accepts(); if ($type == null) { @@ -493,11 +491,10 @@ class RequestHandlerComponent extends Component { * @param object $controller A reference to a controller object * @param string $type Type of response to send (e.g: 'ajax') * @return void - * @access public * @see RequestHandlerComponent::setContent() * @see RequestHandlerComponent::respondAs() */ - function renderAs(&$controller, $type) { + public function renderAs(&$controller, $type) { $options = array('charset' => 'UTF-8'); if (Configure::read('App.encoding') !== null) { @@ -547,10 +544,9 @@ class RequestHandlerComponent extends Component { * @return boolean Returns false if the friendly type name given in $type does * not exist in the type map, or if the Content-type header has * already been set by this method. - * @access public * @see RequestHandlerComponent::setContent() */ - function respondAs($type, $options = array()) { + public function respondAs($type, $options = array()) { $defaults = array('index' => null, 'charset' => null, 'attachment' => false); $options = $options + $defaults; @@ -628,5 +624,4 @@ class RequestHandlerComponent extends Component { } return null; } - }