mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing failing tests, and issues around Controller::$view not getting
set properly.
This commit is contained in:
parent
de57802f05
commit
c8f33b77a1
4 changed files with 12 additions and 5 deletions
|
@ -403,7 +403,14 @@ class Controller extends Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the request objects and configures a number of controller properties
|
* Sets the request objects and configures a number of controller properties
|
||||||
* based on the contents of the request.
|
* based on the contents of the request. The properties that get set are
|
||||||
|
*
|
||||||
|
* - $this->request - To the $request parameter
|
||||||
|
* - $this->plugin - To the $request->params['plugin']
|
||||||
|
* - $this->view - To the $request->params['action']
|
||||||
|
* - $this->autoLayout - To the false if $request->params['bare']; is set.
|
||||||
|
* - $this->autoRender - To false if $request->params['return'] == 1
|
||||||
|
* - $this->passedArgs - The the combined results of params['named'] and params['pass]
|
||||||
*
|
*
|
||||||
* @param CakeRequest $request
|
* @param CakeRequest $request
|
||||||
* @return void
|
* @return void
|
||||||
|
@ -411,7 +418,7 @@ class Controller extends Object {
|
||||||
public function setRequest(CakeRequest $request) {
|
public function setRequest(CakeRequest $request) {
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
$this->plugin = isset($request->params['plugin']) ? $request->params['plugin'] : null;
|
$this->plugin = isset($request->params['plugin']) ? $request->params['plugin'] : null;
|
||||||
|
$this->view = isset($request->params['action']) ? $request->params['action'] : null;
|
||||||
if (isset($request->params['pass']) && isset($request->params['named'])) {
|
if (isset($request->params['pass']) && isset($request->params['named'])) {
|
||||||
$this->passedArgs = array_merge($request->params['pass'], $request->params['named']);
|
$this->passedArgs = array_merge($request->params['pass'], $request->params['named']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,7 @@ class RedirectRoute extends CakeRoute {
|
||||||
$redirect = $this->redirect[0];
|
$redirect = $this->redirect[0];
|
||||||
}
|
}
|
||||||
if (isset($this->options['persist']) && is_array($redirect)) {
|
if (isset($this->options['persist']) && is_array($redirect)) {
|
||||||
$argOptions['context'] = array('action' => $redirect['action'], 'controller' => $redirect['controller']);
|
$redirect += array('named' => $params['named'], 'pass' => $params['pass'], 'url' => array());
|
||||||
$redirect += Router::getArgs($params['_args_'], $argOptions) + array('url' => array());
|
|
||||||
$redirect = Router::reverse($redirect);
|
$redirect = Router::reverse($redirect);
|
||||||
}
|
}
|
||||||
$status = 301;
|
$status = 301;
|
||||||
|
|
|
@ -485,7 +485,7 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
function testEditScaffold() {
|
function testEditScaffold() {
|
||||||
$this->Controller->request->base = '';
|
$this->Controller->request->base = '';
|
||||||
$this->Controller->request->webroot = '/';
|
$this->Controller->request->webroot = '/';
|
||||||
$this->Controller->request->here = '/scaffold_mock';
|
$this->Controller->request->here = '/scaffold_mock/edit/1';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'plugin' => null,
|
'plugin' => null,
|
||||||
|
|
|
@ -171,6 +171,7 @@ class ControllerTestCase extends CakeTestCase {
|
||||||
* Tests a controller action.
|
* Tests a controller action.
|
||||||
*
|
*
|
||||||
* ### Options:
|
* ### Options:
|
||||||
|
*
|
||||||
* - `data` POST or GET data to pass
|
* - `data` POST or GET data to pass
|
||||||
* - `method` POST or GET
|
* - `method` POST or GET
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue