mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fixing more failing tests caused by requestAction
and changes in Controller::__construct.
This commit is contained in:
parent
2141b494cd
commit
173e043eaf
5 changed files with 7 additions and 34 deletions
|
@ -520,9 +520,6 @@ class Controller extends Object {
|
||||||
* @return CakeResponse
|
* @return CakeResponse
|
||||||
*/
|
*/
|
||||||
public function getResponse() {
|
public function getResponse() {
|
||||||
if (empty($this->response)) {
|
|
||||||
$this->response = new $this->_responseClass(array('charset' => Configure::read('App.encoding')));
|
|
||||||
}
|
|
||||||
return $this->response;
|
return $this->response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ class Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
$dispatcher = new Dispatcher();
|
$dispatcher = new Dispatcher();
|
||||||
return $dispatcher->dispatch($request, $extra);
|
return $dispatcher->dispatch($request, new CakeResponse(), $extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -122,12 +122,12 @@ class AuthTestController extends Controller {
|
||||||
* @access private
|
* @access private
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function __construct($request) {
|
function __construct($request, $response) {
|
||||||
$request->addParams(Router::parse('/auth_test'));
|
$request->addParams(Router::parse('/auth_test'));
|
||||||
$request->here = '/auth_test';
|
$request->here = '/auth_test';
|
||||||
$request->webroot = '/';
|
$request->webroot = '/';
|
||||||
Router::setRequestInfo($request);
|
Router::setRequestInfo($request);
|
||||||
parent::__construct($request);
|
parent::__construct($request, $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -339,7 +339,7 @@ class AuthTest extends CakeTestCase {
|
||||||
|
|
||||||
$request = new CakeRequest(null, false);
|
$request = new CakeRequest(null, false);
|
||||||
|
|
||||||
$this->Controller = new AuthTestController($request);
|
$this->Controller = new AuthTestController($request, $this->getMock('CakeResponse'));
|
||||||
|
|
||||||
$collection = new ComponentCollection();
|
$collection = new ComponentCollection();
|
||||||
$collection->init($this->Controller);
|
$collection->init($this->Controller);
|
||||||
|
@ -960,7 +960,7 @@ class AuthTest extends CakeTestCase {
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$Dispatcher = new Dispatcher();
|
$Dispatcher = new Dispatcher();
|
||||||
$Dispatcher->dispatch(new CakeRequest('/ajax_auth/add'), array('return' => 1));
|
$Dispatcher->dispatch(new CakeRequest('/ajax_auth/add'), new CakeResponse(), array('return' => 1));
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$this->assertEqual("Ajax!\nthis is the test element", str_replace("\r\n", "\n", $result));
|
$this->assertEqual("Ajax!\nthis is the test element", str_replace("\r\n", "\n", $result));
|
||||||
|
@ -1024,7 +1024,7 @@ class AuthTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testComponentSettings() {
|
public function testComponentSettings() {
|
||||||
$request = new CakeRequest(null, false);
|
$request = new CakeRequest(null, false);
|
||||||
$this->Controller = new AuthTestController($request);
|
$this->Controller = new AuthTestController($request, $this->getMock('CakeResponse'));
|
||||||
|
|
||||||
$this->Controller->components = array(
|
$this->Controller->components = array(
|
||||||
'Auth' => array(
|
'Auth' => array(
|
||||||
|
|
|
@ -77,30 +77,6 @@ class RequestHandlerTestController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* RequestHandlerTestDisabledController class
|
|
||||||
*
|
|
||||||
* @package cake.tests.cases.libs.controller.components
|
|
||||||
*/
|
|
||||||
class RequestHandlerTestDisabledController extends Controller {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* uses property
|
|
||||||
*
|
|
||||||
* @var mixed null
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
public $uses = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* beforeFilter method
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function beforeFilter() {
|
|
||||||
$this->RequestHandler->enabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RequestHandlerComponentTest class
|
* RequestHandlerComponentTest class
|
||||||
|
|
|
@ -48,7 +48,7 @@ class PagesControllerTest extends CakeTestCase {
|
||||||
CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS
|
CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
$Pages = new PagesController(new CakeRequest(null, false));
|
$Pages = new PagesController(new CakeRequest(null, false), new CakeResponse());
|
||||||
|
|
||||||
$Pages->viewPath = 'Posts';
|
$Pages->viewPath = 'Posts';
|
||||||
$Pages->display('index');
|
$Pages->display('index');
|
||||||
|
|
Loading…
Add table
Reference in a new issue