From 0d94cf15a51457d6af177ea64de44d6fb97b4077 Mon Sep 17 00:00:00 2001 From: Stevie Mayhew Date: Thu, 30 Apr 2015 11:04:08 +1200 Subject: [PATCH] UPDATE: change all instances of $this->request to use appropriate getter/setter --- admin/code/LeftAndMain.php | 18 ++++++------- admin/code/ModelAdmin.php | 10 +++---- admin/code/SecurityAdmin.php | 4 +-- admin/tests/CMSFormTest.php | 4 +-- control/Controller.php | 16 +++++------ control/RequestHandler.php | 11 +++++--- core/PaginatedList.php | 27 +++++++++++++++---- dev/DevelopmentAdmin.php | 2 +- dev/TestRunner.php | 4 +-- .../01_Templates/01_Syntax.md | 2 +- .../01_Templates/How_Tos/02_Pagination.md | 6 ++--- .../02_Controllers/02_Routing.md | 16 +++++------ .../12_Search/01_Searchcontext.md | 4 +-- .../01_ModelAdmin.md | 2 +- forms/HtmlEditorField.php | 2 +- forms/gridfield/GridField.php | 4 +-- security/CMSSecurity.php | 4 +-- security/Security.php | 4 +-- tests/FakeController.php | 5 ++-- tests/api/RestfulServiceTest.php | 8 +++--- tests/forms/EmailFieldTest.php | 4 +-- tests/forms/FormTest.php | 12 ++++----- 22 files changed, 95 insertions(+), 74 deletions(-) diff --git a/admin/code/LeftAndMain.php b/admin/code/LeftAndMain.php index c1d6ebec0..e1de7f851 100644 --- a/admin/code/LeftAndMain.php +++ b/admin/code/LeftAndMain.php @@ -264,7 +264,7 @@ class LeftAndMain extends Controller implements PermissionProvider { if($this->redirectedTo()) return; // Audit logging hook - if(empty($_REQUEST['executeForm']) && !$this->request->isAjax()) $this->extend('accessedCMS'); + if(empty($_REQUEST['executeForm']) && !$this->getRequest()->isAjax()) $this->extend('accessedCMS'); // Set the members html editor config if(Member::currentUser()) { @@ -472,10 +472,10 @@ class LeftAndMain extends Controller implements PermissionProvider { * See LeftAndMain.js for the required jQuery ajaxComplete handlers. */ public function redirect($url, $code=302) { - if($this->request->isAjax()) { + if($this->getRequest()->isAjax()) { $this->response->addHeader('X-ControllerURL', $url); - if($this->request->getHeader('X-Pjax') && !$this->response->getHeader('X-Pjax')) { - $this->response->addHeader('X-Pjax', $this->request->getHeader('X-Pjax')); + if($this->getRequest()->getHeader('X-Pjax') && !$this->response->getHeader('X-Pjax')) { + $this->response->addHeader('X-Pjax', $this->getRequest()->getHeader('X-Pjax')); } $oldResponse = $this->response; $newResponse = new LeftAndMain_HTTPResponse( @@ -786,7 +786,7 @@ class LeftAndMain extends Controller implements PermissionProvider { $filterFunction = null, $nodeCountThreshold = 30) { // Filter criteria - $params = $this->request->getVar('q'); + $params = $this->getRequest()->getVar('q'); if(isset($params['FilterClass']) && $filterClass = $params['FilterClass']){ if(!is_subclass_of($filterClass, 'CMSSiteTreeFilter')) { throw new Exception(sprintf('Invalid filter class passed: %s', $filterClass)); @@ -1006,7 +1006,7 @@ class LeftAndMain extends Controller implements PermissionProvider { $this->setCurrentPageID($record->ID); $this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.SAVEDUP', 'Saved.'))); - return $this->getResponseNegotiator()->respond($this->request); + return $this->getResponseNegotiator()->respond($this->getRequest()); } public function delete($data, $form) { @@ -1021,7 +1021,7 @@ class LeftAndMain extends Controller implements PermissionProvider { $this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.DELETED', 'Deleted.'))); return $this->getResponseNegotiator()->respond( - $this->request, + $this->getRequest(), array('currentform' => array($this, 'EmptyForm')) ); } @@ -1443,8 +1443,8 @@ class LeftAndMain extends Controller implements PermissionProvider { * @return int */ public function currentPageID() { - if($this->request->requestVar('ID') && is_numeric($this->request->requestVar('ID'))) { - return $this->request->requestVar('ID'); + if($this->getRequest()->requestVar('ID') && is_numeric($this->getRequest()->requestVar('ID'))) { + return $this->getRequest()->requestVar('ID'); } elseif (isset($this->urlParams['ID']) && is_numeric($this->urlParams['ID'])) { return $this->urlParams['ID']; } elseif(Session::get($this->sessionNamespace() . ".currentPage")) { diff --git a/admin/code/ModelAdmin.php b/admin/code/ModelAdmin.php index bbf25b9bf..5ef961891 100644 --- a/admin/code/ModelAdmin.php +++ b/admin/code/ModelAdmin.php @@ -98,8 +98,8 @@ abstract class ModelAdmin extends LeftAndMain { $models = $this->getManagedModels(); - if($this->request->param('ModelClass')) { - $this->modelClass = $this->unsanitiseClassName($this->request->param('ModelClass')); + if($this->getRequest()->param('ModelClass')) { + $this->modelClass = $this->unsanitiseClassName($this->getRequest()->param('ModelClass')); } else { reset($models); $this->modelClass = key($models); @@ -200,7 +200,7 @@ abstract class ModelAdmin extends LeftAndMain { $form->setFormAction($this->Link($this->sanitiseClassName($this->modelClass))); $form->addExtraClass('cms-search-form'); $form->disableSecurityToken(); - $form->loadDataFrom($this->request->getVars()); + $form->loadDataFrom($this->getRequest()->getVars()); $this->extend('updateSearchForm', $form); @@ -209,7 +209,7 @@ abstract class ModelAdmin extends LeftAndMain { public function getList() { $context = $this->getSearchContext(); - $params = $this->request->requestVar('q'); + $params = $this->getRequest()->requestVar('q'); if(is_array($params)) { $params = array_map('trim', $params); @@ -449,7 +449,7 @@ abstract class ModelAdmin extends LeftAndMain { // Show the class name rather than ModelAdmin title as root node $models = $this->getManagedModels(); - $params = $this->request->getVars(); + $params = $this->getRequest()->getVars(); if(isset($params['url'])) unset($params['url']); $items[0]->Title = $models[$this->modelClass]['title']; diff --git a/admin/code/SecurityAdmin.php b/admin/code/SecurityAdmin.php index 8220ceda6..aef46e0b7 100755 --- a/admin/code/SecurityAdmin.php +++ b/admin/code/SecurityAdmin.php @@ -166,7 +166,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { $rolesTab->push($rolesField); } - $actionParam = $this->request->param('Action'); + $actionParam = $this->getRequest()->param('Action'); if($actionParam == 'groups') { $groupsTab->addExtraClass('ui-state-active'); } elseif($actionParam == 'users') { @@ -273,7 +273,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { // Name root breadcrumb based on which record is edited, // which can only be determined by looking for the fieldname of the GridField. // Note: Titles should be same titles as tabs in RootForm(). - $params = $this->request->allParams(); + $params = $this->getRequest()->allParams(); if(isset($params['FieldName'])) { // TODO FieldName param gets overwritten by nested GridFields, // so shows "Members" rather than "Groups" for the following URL: diff --git a/admin/tests/CMSFormTest.php b/admin/tests/CMSFormTest.php index 7095de33e..efb8bf0ae 100644 --- a/admin/tests/CMSFormTest.php +++ b/admin/tests/CMSFormTest.php @@ -81,8 +81,8 @@ class CMSFormTest_Controller extends Controller implements TestOnly { protected $template = 'BlankPage'; public function Link($action = null) { - return Controller::join_links('CMSFormTest_Controller', $this->request->latestParam('Action'), - $this->request->latestParam('ID'), $action); + return Controller::join_links('CMSFormTest_Controller', $this->getRequest()->latestParam('Action'), + $this->getRequest()->latestParam('ID'), $action); } public function Form() { diff --git a/control/Controller.php b/control/Controller.php index c060af523..1680f36d8 100644 --- a/control/Controller.php +++ b/control/Controller.php @@ -118,7 +118,7 @@ class Controller extends RequestHandler implements TemplateGlobalProvider { $this->pushCurrent(); $this->urlParams = $request->allParams(); - $this->request = $request; + $this->setRequest($request); $this->response = new SS_HTTPResponse(); $this->setDataModel($model); @@ -487,13 +487,13 @@ class Controller extends RequestHandler implements TemplateGlobalProvider { // In edge-cases, this will be called outside of a handleRequest() context; in that case, // redirect to the homepage - don't break into the global state at this stage because we'll // be calling from a test context or something else where the global state is inappropraite - if($this->request) { - if($this->request->requestVar('BackURL')) { - $url = $this->request->requestVar('BackURL'); - } else if($this->request->isAjax() && $this->request->getHeader('X-Backurl')) { - $url = $this->request->getHeader('X-Backurl'); - } else if($this->request->getHeader('Referer')) { - $url = $this->request->getHeader('Referer'); + if($this->getRequest()) { + if($this->getRequest()->requestVar('BackURL')) { + $url = $this->getRequest()->requestVar('BackURL'); + } else if($this->getRequest()->isAjax() && $this->getRequest()->getHeader('X-Backurl')) { + $url = $this->getRequest()->getHeader('X-Backurl'); + } else if($this->getRequest()->getHeader('Referer')) { + $url = $this->getRequest()->getHeader('Referer'); } } diff --git a/control/RequestHandler.php b/control/RequestHandler.php index 64995029f..1cbb41f56 100644 --- a/control/RequestHandler.php +++ b/control/RequestHandler.php @@ -111,7 +111,7 @@ class RequestHandler extends ViewableData { $this->brokenOnConstruct = false; // Check necessary to avoid class conflicts before manifest is rebuilt - if(class_exists('NullHTTPRequest')) $this->request = new NullHTTPRequest(); + if(class_exists('NullHTTPRequest')) $this->setRequest(new NullHTTPRequest()); // This will prevent bugs if setDataModel() isn't called. $this->model = DataModel::inst(); @@ -155,7 +155,7 @@ class RequestHandler extends ViewableData { user_error("parent::__construct() needs to be called on {$handlerClass}::__construct()", E_USER_WARNING); } - $this->request = $request; + $this->setRequest($request); $this->setDataModel($model); $match = $this->findAction($request); @@ -462,11 +462,14 @@ class RequestHandler extends ViewableData { * @uses SS_HTTPResponse_Exception */ public function httpError($errorCode, $errorMessage = null) { + + $request = $this->getRequest(); + // Call a handler method such as onBeforeHTTPError404 - $this->extend('onBeforeHTTPError' . $errorCode, $this->request); + $this->extend('onBeforeHTTPError' . $errorCode, $request); // Call a handler method such as onBeforeHTTPError, passing 404 as the first arg - $this->extend('onBeforeHTTPError', $errorCode, $this->request); + $this->extend('onBeforeHTTPError', $errorCode, $request); // Throw a new exception throw new SS_HTTPResponse_Exception($errorMessage, $errorCode); diff --git a/core/PaginatedList.php b/core/PaginatedList.php index 43156d2a4..0d8c87d61 100644 --- a/core/PaginatedList.php +++ b/core/PaginatedList.php @@ -28,7 +28,7 @@ class PaginatedList extends SS_ListDecorator { throw new Exception('The request must be readable as an array.'); } - $this->request = $request; + $this->setRequest($request); parent::__construct($list); } @@ -92,13 +92,14 @@ class PaginatedList extends SS_ListDecorator { * @return int */ public function getPageStart() { + $request = $this->getRequest(); if ($this->pageStart === null) { if( - $this->request - && isset($this->request[$this->getPaginationGetVar()]) - && $this->request[$this->getPaginationGetVar()] > 0 + $request + && isset($request[$this->getPaginationGetVar()]) + && $request[$this->getPaginationGetVar()] > 0 ) { - $this->pageStart = (int)$this->request[$this->getPaginationGetVar()]; + $this->pageStart = (int)$request[$this->getPaginationGetVar()]; } else { $this->pageStart = 0; } @@ -433,4 +434,20 @@ class PaginatedList extends SS_ListDecorator { } } + /** + * Set the request object for this list + * + * @param SS_HTTPRequest + */ + public function setRequest($request) { + $this->request = $request; + } + + /** + * Get the request object for this list + */ + public function getRequest() { + return $this->request; + } + } diff --git a/dev/DevelopmentAdmin.php b/dev/DevelopmentAdmin.php index ef7271186..348391085 100644 --- a/dev/DevelopmentAdmin.php +++ b/dev/DevelopmentAdmin.php @@ -33,7 +33,7 @@ class DevelopmentAdmin extends Controller { parent::init(); // Special case for dev/build: Defer permission checks to DatabaseAdmin->init() (see #4957) - $requestedDevBuild = (stripos($this->request->getURL(), 'dev/build') === 0); + $requestedDevBuild = (stripos($this->getRequest()->getURL(), 'dev/build') === 0); // We allow access to this controller regardless of live-status or ADMIN permission only // if on CLI. Access to this controller is always allowed in "dev-mode", or of the user is ADMIN. diff --git a/dev/TestRunner.php b/dev/TestRunner.php index bfb855b3a..0b516ad76 100755 --- a/dev/TestRunner.php +++ b/dev/TestRunner.php @@ -357,8 +357,8 @@ class TestRunner extends Controller { // Optionally skip certain tests $skipTests = array(); - if($this->request->getVar('SkipTests')) { - $skipTests = explode(',', $this->request->getVar('SkipTests')); + if($this->getRequest()->getVar('SkipTests')) { + $skipTests = explode(',', $this->getRequest()->getVar('SkipTests')); } $abstractClasses = array(); diff --git a/docs/en/02_Developer_Guides/01_Templates/01_Syntax.md b/docs/en/02_Developer_Guides/01_Templates/01_Syntax.md index 8b8c50e44..e94005dfa 100644 --- a/docs/en/02_Developer_Guides/01_Templates/01_Syntax.md +++ b/docs/en/02_Developer_Guides/01_Templates/01_Syntax.md @@ -84,7 +84,7 @@ Variables can come from your database fields, or custom methods you define on yo :::php public function UsersIpAddress() { - return $this->request->getIP(); + return $this->getRequest()->getIP(); } **mysite/code/Page.ss** diff --git a/docs/en/02_Developer_Guides/01_Templates/How_Tos/02_Pagination.md b/docs/en/02_Developer_Guides/01_Templates/How_Tos/02_Pagination.md index 90739a8b1..46872a793 100644 --- a/docs/en/02_Developer_Guides/01_Templates/How_Tos/02_Pagination.md +++ b/docs/en/02_Developer_Guides/01_Templates/How_Tos/02_Pagination.md @@ -17,7 +17,7 @@ The `PaginatedList` will automatically set up query limits and read the request public function PaginatedPages() { $list = Page::get(); - return new PaginatedList($list, $this->request); + return new PaginatedList($list, $this->getRequest()); }
@@ -78,14 +78,14 @@ when using custom lists. :::php $myPreLimitedList = Page::get()->limit(10); - $pages = new PaginatedList($myPreLimitedList, $this->request); + $pages = new PaginatedList($myPreLimitedList, $this->getRequest()); $pages->setLimitItems(false); ## Setting the limit of items :::php - $pages = new PaginatedList(Page::get(), $this->request); + $pages = new PaginatedList(Page::get(), $this->getRequest()); $pages->setPageLength(25); If you set this limit to 0 it will disable paging entirely, effectively causing it to appear as a single page diff --git a/docs/en/02_Developer_Guides/02_Controllers/02_Routing.md b/docs/en/02_Developer_Guides/02_Controllers/02_Routing.md index 876f50809..899fe44bb 100644 --- a/docs/en/02_Developer_Guides/02_Controllers/02_Routing.md +++ b/docs/en/02_Developer_Guides/02_Controllers/02_Routing.md @@ -41,10 +41,10 @@ This route has defined that any URL beginning with `team` should create, and be It also contains 3 `parameters` or `params` for short. `$Action`, `$ID` and `$Name`. These variables are placeholders which will be filled when the user makes their request. Request parameters are available on the `SS_HTTPRequest` object -and able to be pulled out from a controller using `$this->request->param($name)`. +and able to be pulled out from a controller using `$this->getRequest()->param($name)`.
-All Controllers have access to `$this->request` for the request object and `$this->response` for the response. +All Controllers have access to `$this->getRequest()` for the request object and `$this->response` for the response.
Here is what those parameters would look like for certain requests @@ -52,7 +52,7 @@ Here is what those parameters would look like for certain requests :::php // GET /teams/ - print_r($this->request->params()); + print_r($this->getRequest()->params()); // Array // ( @@ -63,7 +63,7 @@ Here is what those parameters would look like for certain requests // GET /teams/players/ - print_r($this->request->params()); + print_r($this->getRequest()->params()); // Array // ( @@ -74,7 +74,7 @@ Here is what those parameters would look like for certain requests // GET /teams/players/1 - print_r($this->request->params()); + print_r($this->getRequest()->params()); // Array // ( @@ -89,7 +89,7 @@ You can also fetch one parameter at a time. // GET /teams/players/1/ - echo $this->request->param('ID'); + echo $this->getRequest()->param('ID'); // returns '1' @@ -184,8 +184,8 @@ parameters. ); public function go() { $this->validateUser( - $this->request->param('UserName'), - $this->request->param('AuthToken') + $this->getRequest()->param('UserName'), + $this->getRequest()->param('AuthToken') ); /* more processing goes here */ } diff --git a/docs/en/02_Developer_Guides/12_Search/01_Searchcontext.md b/docs/en/02_Developer_Guides/12_Search/01_Searchcontext.md index 591eee134..b72ecef77 100644 --- a/docs/en/02_Developer_Guides/12_Search/01_Searchcontext.md +++ b/docs/en/02_Developer_Guides/12_Search/01_Searchcontext.md @@ -116,7 +116,7 @@ in order to read page limit information. It is also passed the current :::php public function getResults($searchCriteria = array()) { - $start = ($this->request->getVar('start')) ? (int)$this->request->getVar('start') : 0; + $start = ($this->getRequest()->getVar('start')) ? (int)$this->getRequest()->getVar('start') : 0; $limit = 10; $context = singleton('MyDataObject')->getCustomSearchContext(); @@ -124,7 +124,7 @@ in order to read page limit information. It is also passed the current $records = $context->getResults($searchCriteria, null, array('start'=>$start,'limit'=>$limit)); if($records) { - $records = new PaginatedList($records, $this->request); + $records = new PaginatedList($records, $this->getRequest()); $records->setPageStart($start); $records->setPageLength($limit); $records->setTotalItems($query->unlimitedRowCount()); diff --git a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/01_ModelAdmin.md b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/01_ModelAdmin.md index 21f47e692..239d045cc 100644 --- a/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/01_ModelAdmin.md +++ b/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/01_ModelAdmin.md @@ -215,7 +215,7 @@ checkbox which limits search results to expensive products (over $100). public function getList() { $list = parent::getList(); - $params = $this->request->requestVar('q'); // use this to access search parameters + $params = $this->getRequest()->requestVar('q'); // use this to access search parameters if($this->modelClass == 'Product' && isset($params['ExpensiveOnly']) && $params['ExpensiveOnly']) { $list = $list->exclude('Price:LessThan', '100'); diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index 34b626d94..7cda6f3a9 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -506,7 +506,7 @@ class HtmlEditorField_Toolbar extends RequestHandler { * @return array */ public function getanchors() { - $id = (int)$this->request->getVar('PageID'); + $id = (int)$this->getRequest()->getVar('PageID'); $anchors = array(); if (($page = Page::get()->byID($id)) && !empty($page)) { diff --git a/forms/gridfield/GridField.php b/forms/gridfield/GridField.php index 20f065fb6..5e89812f3 100644 --- a/forms/gridfield/GridField.php +++ b/forms/gridfield/GridField.php @@ -689,10 +689,10 @@ class GridField extends FormField { user_error("parent::__construct() needs to be called on {$handlerClass}::__construct()", E_USER_WARNING); } - $this->request = $request; + $this->setRequest($request); $this->setDataModel($model); - $fieldData = $this->request->requestVar($this->getName()); + $fieldData = $this->getRequest()->requestVar($this->getName()); if($fieldData && isset($fieldData['GridState'])) $this->getState(false)->setValue($fieldData['GridState']); foreach($this->getComponents() as $component) { diff --git a/security/CMSSecurity.php b/security/CMSSecurity.php index 3bee34b24..3fb66ef8f 100644 --- a/security/CMSSecurity.php +++ b/security/CMSSecurity.php @@ -50,7 +50,7 @@ class CMSSecurity extends Security { * @return Member */ public function getTargetMember() { - if($tempid = $this->request->requestVar('tempid')) { + if($tempid = $this->getRequest()->requestVar('tempid')) { return Member::member_from_tempid($tempid); } } @@ -191,7 +191,7 @@ PHP // Get redirect url $controller = $this->getResponseController(_t('CMSSecurity.SUCCESS', 'Success')); - $backURL = $this->request->requestVar('BackURL') + $backURL = $this->getRequest()->requestVar('BackURL') ?: Session::get('BackURL') ?: Director::absoluteURL(AdminRootController::config()->url_base, true); diff --git a/security/Security.php b/security/Security.php index 77f6ed4c7..dbc48da6c 100644 --- a/security/Security.php +++ b/security/Security.php @@ -318,7 +318,7 @@ class Security extends Controller implements TemplateGlobalProvider { * @return string Class name of Authenticator */ protected function getAuthenticator() { - $authenticator = $this->request->requestVar('AuthenticationMethod'); + $authenticator = $this->getRequest()->requestVar('AuthenticationMethod'); if($authenticator) { $authenticators = Authenticator::get_authenticators(); if(in_array($authenticator, $authenticators)) { @@ -420,7 +420,7 @@ class Security extends Controller implements TemplateGlobalProvider { // This step is necessary in cases such as automatic redirection where a user is authenticated // upon landing on an SSL secured site and is automatically logged in, or some other case // where the user has permissions to continue but is not given the option. - if($this->request->requestVar('BackURL') + if($this->getRequest()->requestVar('BackURL') && !$this->getLoginMessage() && ($member = Member::currentUser()) && $member->exists() diff --git a/tests/FakeController.php b/tests/FakeController.php index 5eac972ad..f24f0bf56 100644 --- a/tests/FakeController.php +++ b/tests/FakeController.php @@ -10,13 +10,14 @@ class FakeController extends Controller { $this->pushCurrent(); - $this->request = new SS_HTTPRequest( + $request = new SS_HTTPRequest( (isset($_SERVER['X-HTTP-Method-Override'])) ? $_SERVER['X-HTTP-Method-Override'] : $_SERVER['REQUEST_METHOD'], '/' ); - + $this->setRequest($request); + $this->response = new SS_HTTPResponse(); $this->init(); diff --git a/tests/api/RestfulServiceTest.php b/tests/api/RestfulServiceTest.php index 59baccb78..36fcf2765 100644 --- a/tests/api/RestfulServiceTest.php +++ b/tests/api/RestfulServiceTest.php @@ -343,18 +343,18 @@ class RestfulServiceTest_Controller extends Controller implements TestOnly { public function index() { $request = ''; - foreach ($this->request->requestVars() as $key=>$value) { + foreach ($this->getRequest()->requestVars() as $key=>$value) { $request .= "\t\t$value\n"; } $get = ''; - foreach ($this->request->getVars() as $key => $value) { + foreach ($this->getRequest()->getVars() as $key => $value) { $get .= "\t\t$value\n"; } $post = ''; - foreach ($this->request->postVars() as $key => $value) { + foreach ($this->getRequest()->postVars() as $key => $value) { $post .= "\t\t$value\n"; } - $body = $this->request->getBody(); + $body = $this->getRequest()->getBody(); $out = << diff --git a/tests/forms/EmailFieldTest.php b/tests/forms/EmailFieldTest.php index a3d446170..a9b10dca2 100644 --- a/tests/forms/EmailFieldTest.php +++ b/tests/forms/EmailFieldTest.php @@ -84,8 +84,8 @@ class EmailFieldTest_Controller extends Controller implements TestOnly { function Link($action = null) { return Controller::join_links( 'EmailFieldTest_Controller', - $this->request->latestParam('Action'), - $this->request->latestParam('ID'), + $this->getRequest()->latestParam('Action'), + $this->getRequest()->latestParam('ID'), $action ); } diff --git a/tests/forms/FormTest.php b/tests/forms/FormTest.php index d6f89a413..99245c18c 100644 --- a/tests/forms/FormTest.php +++ b/tests/forms/FormTest.php @@ -654,8 +654,8 @@ class FormTest_Controller extends Controller implements TestOnly { protected $template = 'BlankPage'; public function Link($action = null) { - return Controller::join_links('FormTest_Controller', $this->request->latestParam('Action'), - $this->request->latestParam('ID'), $action); + return Controller::join_links('FormTest_Controller', $this->getRequest()->latestParam('Action'), + $this->getRequest()->latestParam('ID'), $action); } public function Form() { @@ -706,8 +706,8 @@ class FormTest_ControllerWithSecurityToken extends Controller implements TestOnl protected $template = 'BlankPage'; public function Link($action = null) { - return Controller::join_links('FormTest_ControllerWithSecurityToken', $this->request->latestParam('Action'), - $this->request->latestParam('ID'), $action); + return Controller::join_links('FormTest_ControllerWithSecurityToken', $this->getRequest()->latestParam('Action'), + $this->getRequest()->latestParam('ID'), $action); } public function Form() { @@ -741,8 +741,8 @@ class FormTest_ControllerWithStrictPostCheck extends Controller implements TestO public function Link($action = null) { return Controller::join_links( 'FormTest_ControllerWithStrictPostCheck', - $this->request->latestParam('Action'), - $this->request->latestParam('ID'), + $this->getRequest()->latestParam('Action'), + $this->getRequest()->latestParam('ID'), $action ); }