Skip to content
Permalink
Browse files

Update Request constructor use in test cases.

  • Loading branch information...
markstory committed Jun 4, 2012
1 parent 2eb2b1e commit 4c24a67ca1a16a4aab0e5a9ae493fe28057d6afe
Showing with 82 additions and 82 deletions.
  1. +1 −1 App/webroot/index.php
  2. +1 −1 lib/Cake/Console/Templates/skel/webroot/index.php
  3. +1 −1 lib/Cake/Core/Object.php
  4. +1 −1 lib/Cake/Error/ExceptionRenderer.php
  5. +5 −5 lib/Cake/Test/TestCase/Controller/Component/Auth/ActionsAuthorizeTest.php
  6. +7 −7 lib/Cake/Test/TestCase/Controller/Component/Auth/BasicAuthenticateTest.php
  7. +2 −2 lib/Cake/Test/TestCase/Controller/Component/Auth/ControllerAuthorizeTest.php
  8. +3 −3 lib/Cake/Test/TestCase/Controller/Component/Auth/CrudAuthorizeTest.php
  9. +5 −5 lib/Cake/Test/TestCase/Controller/Component/Auth/DigestAuthenticateTest.php
  10. +7 −7 lib/Cake/Test/TestCase/Controller/Component/Auth/FormAuthenticateTest.php
  11. +3 −3 lib/Cake/Test/TestCase/Controller/Component/AuthComponentTest.php
  12. +1 −1 lib/Cake/Test/TestCase/Controller/Component/SecurityComponentTest.php
  13. +1 −1 lib/Cake/Test/TestCase/Controller/ControllerTest.php
  14. +1 −1 lib/Cake/Test/TestCase/Controller/PagesControllerTest.php
  15. +2 −2 lib/Cake/Test/TestCase/Controller/ScaffoldTest.php
  16. +1 −1 lib/Cake/Test/TestCase/Error/ErrorHandlerTest.php
  17. +3 −3 lib/Cake/Test/TestCase/Error/ExceptionRendererTest.php
  18. +25 −25 lib/Cake/Test/TestCase/Network/RequestTest.php
  19. +2 −2 lib/Cake/Test/TestCase/Routing/DispatcherTest.php
  20. +2 −2 lib/Cake/Test/TestCase/Routing/RouterTest.php
  21. +1 −1 lib/Cake/Test/TestCase/View/Helper/FormHelperTest.php
  22. +1 −1 lib/Cake/Test/TestCase/View/Helper/HtmlHelperTest.php
  23. +2 −2 lib/Cake/Test/TestCase/View/Helper/JsHelperTest.php
  24. +2 −2 lib/Cake/Test/TestCase/View/Helper/PaginatorHelperTest.php
  25. +1 −1 lib/Cake/Test/TestCase/View/HelperTest.php
  26. +1 −1 lib/Cake/Test/TestCase/View/ScaffoldViewTest.php
@@ -92,4 +92,4 @@
use Cake\Routing\Dispatcher;
$Dispatcher = new Dispatcher();
$Dispatcher->dispatch(new Request(), new Response(array('charset' => Configure::read('App.encoding'))));
$Dispatcher->dispatch(Request::createFromGlobals(), new Response(array('charset' => Configure::read('App.encoding'))));
@@ -95,6 +95,6 @@
$Dispatcher = new Dispatcher();
$Dispatcher->dispatch(
new Request(),
Request::createFromGlobals(),
new Response(array('charset' => Configure::read('App.encoding')))
);
@@ -92,7 +92,7 @@ public function requestAction($url, $extra = array()) {
} elseif (is_array($url)) {
$params = $url + array('pass' => array(), 'named' => array(), 'base' => false);
$params = array_merge($params, $extra);
$request = new Request(Router::reverse($params), false);
$request = new Request(Router::reverse($params));
}
if (isset($data)) {
$request->data = $data;
@@ -149,7 +149,7 @@ public function __construct(\Exception $exception) {
*/
protected function _getController($exception) {
if (!$request = Router::getRequest(true)) {
$request = new Request();
$request = Request::createFromGlobals();
}
$response = new Response(array('charset' => Configure::read('App.encoding')));
try {
@@ -62,7 +62,7 @@ public function testAuthorizeFailure() {
'user' => 'mariano'
)
);
$request = new Request('/posts/index', false);
$request = new Request('/posts/index');
$request->addParams(array(
'plugin' => null,
'controller' => 'posts',
@@ -91,7 +91,7 @@ public function testAuthorizeSuccess() {
'user' => 'mariano'
)
);
$request = new Request('/posts/index', false);
$request = new Request('/posts/index');
$request->addParams(array(
'plugin' => null,
'controller' => 'posts',
@@ -114,7 +114,7 @@ public function testAuthorizeSuccess() {
* @return void
*/
public function testAuthorizeSettings() {
$request = new Request('/posts/index', false);
$request = new Request('/posts/index');
$request->addParams(array(
'plugin' => null,
'controller' => 'posts',
@@ -144,7 +144,7 @@ public function testAuthorizeSettings() {
* @return void
*/
public function testActionMethod() {
$request = new Request('/posts/index', false);
$request = new Request('/posts/index');
$request->addParams(array(
'plugin' => null,
'controller' => 'posts',
@@ -177,7 +177,7 @@ public function testActionNoDoubleSlash() {
* @return void
*/
public function testActionWithPlugin() {
$request = new Request('/debug_kit/posts/index', false);
$request = new Request('/debug_kit/posts/index');
$request->addParams(array(
'plugin' => 'debug_kit',
'controller' => 'posts',
@@ -76,7 +76,7 @@ public function testConstructor() {
* @return void
*/
public function testAuthenticateNoData() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$this->response->expects($this->once())
->method('header')
@@ -91,7 +91,7 @@ public function testAuthenticateNoData() {
* @return void
*/
public function testAuthenticateNoUsername() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$_SERVER['PHP_AUTH_PW'] = 'foobar';
$this->response->expects($this->once())
@@ -107,7 +107,7 @@ public function testAuthenticateNoUsername() {
* @return void
*/
public function testAuthenticateNoPassword() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$_SERVER['PHP_AUTH_USER'] = 'mariano';
$_SERVER['PHP_AUTH_PW'] = null;
@@ -124,7 +124,7 @@ public function testAuthenticateNoPassword() {
* @return void
*/
public function testAuthenticateInjection() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->addParams(array('pass' => array(), 'named' => array()));
$_SERVER['PHP_AUTH_USER'] = '> 1';
@@ -139,7 +139,7 @@ public function testAuthenticateInjection() {
* @return void
*/
public function testAuthenticateChallenge() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->addParams(array('pass' => array(), 'named' => array()));
$this->response->expects($this->at(0))
@@ -159,7 +159,7 @@ public function testAuthenticateChallenge() {
* @return void
*/
public function testAuthenticateSuccess() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->addParams(array('pass' => array(), 'named' => array()));
$_SERVER['PHP_AUTH_USER'] = 'mariano';
@@ -182,7 +182,7 @@ public function testAuthenticateSuccess() {
*/
public function testAuthenticateFailReChallenge() {
$this->auth->settings['scope'] = array('user' => 'nate');
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->addParams(array('pass' => array(), 'named' => array()));
$_SERVER['PHP_AUTH_USER'] = 'mariano';
@@ -61,7 +61,7 @@ public function testControllerErrorOnMissingMethod() {
*/
public function testAuthorizeFailure() {
$user = array();
$request = new Request('/posts/index', false);
$request = new Request('/posts/index');
$this->assertFalse($this->auth->authorize($user, $request));
}
@@ -72,7 +72,7 @@ public function testAuthorizeFailure() {
*/
public function testAuthorizeSuccess() {
$user = array('User' => array('username' => 'mark'));
$request = new Request('/posts/index', false);
$request = new Request('/posts/index');
$this->controller->expects($this->once())
->method('isAuthorized')
@@ -59,7 +59,7 @@ protected function _mockAcl() {
* @return void
*/
public function testAuthorizeNoMappedAction() {
$request = new Request('/posts/foobar', false);
$request = new Request('/posts/foobar');
$request->addParams(array(
'controller' => 'posts',
'action' => 'foobar'
@@ -75,7 +75,7 @@ public function testAuthorizeNoMappedAction() {
* @return void
*/
public function testAuthorizeCheckSuccess() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->addParams(array(
'controller' => 'posts',
'action' => 'index'
@@ -97,7 +97,7 @@ public function testAuthorizeCheckSuccess() {
* @return void
*/
public function testAuthorizeCheckFailure() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->addParams(array(
'controller' => 'posts',
'action' => 'index'
@@ -91,7 +91,7 @@ public function testConstructor() {
* @return void
*/
public function testAuthenticateNoData() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$this->response->expects($this->once())
->method('header')
@@ -106,7 +106,7 @@ public function testAuthenticateNoData() {
* @return void
*/
public function testAuthenticateWrongUsername() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->addParams(array('pass' => array(), 'named' => array()));
$_SERVER['PHP_AUTH_DIGEST'] = <<<DIGEST
@@ -141,7 +141,7 @@ public function testAuthenticateWrongUsername() {
* @return void
*/
public function testAuthenticateChallenge() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->addParams(array('pass' => array(), 'named' => array()));
$this->response->expects($this->at(0))
@@ -165,7 +165,7 @@ public function testAuthenticateChallenge() {
* @return void
*/
public function testAuthenticateSuccess() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->addParams(array('pass' => array(), 'named' => array()));
$_SERVER['PHP_AUTH_DIGEST'] = <<<DIGEST
@@ -197,7 +197,7 @@ public function testAuthenticateSuccess() {
*/
public function testAuthenticateFailReChallenge() {
$this->auth->settings['scope'] = array('user' => 'nate');
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->addParams(array('pass' => array(), 'named' => array()));
$_SERVER['PHP_AUTH_DIGEST'] = <<<DIGEST
@@ -77,7 +77,7 @@ public function testConstructor() {
* @return void
*/
public function testAuthenticateNoData() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->data = array();
$this->assertFalse($this->auth->authenticate($request, $this->response));
}
@@ -88,7 +88,7 @@ public function testAuthenticateNoData() {
* @return void
*/
public function testAuthenticateNoUsername() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->data = array('User' => array('password' => 'foobar'));
$this->assertFalse($this->auth->authenticate($request, $this->response));
}
@@ -99,7 +99,7 @@ public function testAuthenticateNoUsername() {
* @return void
*/
public function testAuthenticateNoPassword() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->data = array('User' => array('user' => 'mariano'));
$this->assertFalse($this->auth->authenticate($request, $this->response));
}
@@ -110,7 +110,7 @@ public function testAuthenticateNoPassword() {
* @return void
*/
public function testAuthenticateInjection() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->data = array(
'User' => array(
'user' => '> 1',
@@ -125,7 +125,7 @@ public function testAuthenticateInjection() {
* @return void
*/
public function testAuthenticateSuccess() {
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->data = array('User' => array(
'user' => 'mariano',
'password' => 'password'
@@ -147,7 +147,7 @@ public function testAuthenticateSuccess() {
*/
public function testAuthenticateScopeFail() {
$this->auth->settings['scope'] = array('user' => 'nate');
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->data = array('User' => array(
'user' => 'mariano',
'password' => 'password'
@@ -177,7 +177,7 @@ public function testPluginModel() {
$this->auth->settings['userModel'] = 'TestPlugin.TestPluginAuthUser';
$this->auth->settings['fields']['username'] = 'username';
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->data = array('TestPluginAuthUser' => array(
'username' => 'gwoo',
'password' => 'cake'
@@ -75,7 +75,7 @@ public function setUp() {
Configure::write('Security.cipherSeed', 770011223369876);
Configure::write('App.namespace', 'TestApp');
$request = new Request(null, false);
$request = new Request();
$this->Controller = new AuthTestController($request, $this->getMock('Cake\Network\Response'));
@@ -841,7 +841,7 @@ public function testShutDown() {
* @return void
*/
public function testComponentSettings() {
$request = new Request(null, false);
$request = new Request();
$this->Controller = new AuthTestController($request, $this->getMock('Cake\Network\Response'));
$this->Controller->components = array(
@@ -921,7 +921,7 @@ class_alias('MapActionMockAuthorize', 'Cake\Controller\Component\Auth\MapActionM
public function testLoginWithRequestData() {
$this->getMock('Cake\Controller\Component\Auth\FormAuthenticate', array(), array(), 'RequestLoginMockAuthenticate', false);
class_alias('RequestLoginMockAuthenticate', 'Cake\Controller\Component\Auth\RequestLoginMockAuthenticate');
$request = new Request('users/login', false);
$request = new Request('users/login');
$user = array('username' => 'mark', 'role' => 'admin');
$this->Auth->request = $request;
@@ -143,7 +143,7 @@ class SecurityComponentTest extends TestCase {
public function setUp() {
parent::setUp();
$request = new Request('posts/index', false);
$request = new Request('posts/index');
$request->addParams(array('controller' => 'posts', 'action' => 'index'));
$this->Controller = new SecurityTestController($request);
$this->Controller->Components->init($this->Controller);
@@ -1260,7 +1260,7 @@ public function testShutdownProcessIndirect() {
* @return void
*/
public function testPropertyBackwardsCompatibility() {
$request = new Request('posts/index', null);
$request = new Request('posts/index');
$request->addParams(array('controller' => 'posts', 'action' => 'index'));
$request->data = array('Post' => array('id' => 1));
$request->here = '/posts/index';
@@ -41,7 +41,7 @@ public function testDisplay() {
CAKE . 'Test' . DS . 'TestApp' . DS . 'View' . DS
)
));
$Pages = new PagesController(new Request(null, false), new Response());
$Pages = new PagesController(new Request(), new Response());
$Pages->viewPath = 'Posts';
$Pages->display('index');
@@ -137,7 +137,7 @@ class ScaffoldTest extends TestCase {
*/
public function setUp() {
parent::setUp();
$request = new Request(null, false);
$request = new Request();
$this->Controller = new ScaffoldMockController($request);
$this->Controller->response = $this->getMock('Cake\Network\Response', array('_sendHeader'));
}
@@ -319,7 +319,7 @@ public function testHabtmFieldAdditionWithScaffoldForm() {
* @return void
*/
public function testEditScaffoldWithScaffoldFields() {
$request = new Request(null, false);
$request = new Request();
$this->Controller = new ScaffoldMockControllerWithFields($request);
$this->Controller->response = $this->getMock('Cake\Network\Response', array('_sendHeader'));
@@ -51,7 +51,7 @@ public function setUp() {
), App::RESET);
Router::reload();
$request = new Request(null, false);
$request = new Request();
$request->base = '';
Router::setRequestInfo($request);
Configure::write('debug', 2);
Oops, something went wrong.

0 comments on commit 4c24a67

Please sign in to comment.
You can’t perform that action at this time.