Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Making Controller tests pass.

  • Loading branch information...
commit fc08784c22c4a104595671a51dfb215a5856c7ba 1 parent ec40ce6
Mark Story markstory authored markstory committed
Showing with 11 additions and 9 deletions.
  1. +11 −9 lib/Cake/Test/Case/Controller/ControllerTest.php
20 lib/Cake/Test/Case/Controller/ControllerTest.php
View
@@ -418,7 +418,8 @@ public function teardown() {
*/
public function testLoadModel() {
$request = new CakeRequest('controller_posts/index');
- $Controller = new Controller($request);
+ $response = $this->getMock('CakeResponse');
+ $Controller = new Controller($request, $response);
$this->assertFalse(isset($Controller->ControllerPost));
@@ -617,7 +618,7 @@ public function testRender() {
$request = new CakeRequest('controller_posts/index');
$request->params['action'] = 'index';
- $Controller = new Controller($request, $this->getMock('CakeResponse'));
+ $Controller = new Controller($request, new CakeResponse());
$Controller->viewPath = 'Posts';
$result = $Controller->render('index');
@@ -631,7 +632,7 @@ public function testRender() {
$this->assertPattern('/this is the test element/', $result);
$Controller->view = null;
- $Controller = new TestController($request);
+ $Controller = new TestController($request, new CakeResponse());
$Controller->helpers = array('Html');
$Controller->constructClasses();
$Controller->ControllerComment->validationErrors = array('title' => 'tooShort');
@@ -668,7 +669,7 @@ public function testComponentBeforeRenderChangingViewClass() {
CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS
)
), true);
- $Controller = new Controller($this->getMock('CakeRequest'));
+ $Controller = new Controller($this->getMock('CakeRequest'), new CakeResponse());
$Controller->uses = array();
$Controller->components = array('Test');
$Controller->constructClasses();
@@ -689,7 +690,7 @@ public function testComponentBeforeRenderChangingViewClass() {
public function testToBeInheritedGuardmethods() {
$request = new CakeRequest('controller_posts/index');
- $Controller = new Controller($request);
+ $Controller = new Controller($request, $this->getMock('CakeResponse'));
$this->assertTrue($Controller->_beforeScaffold(''));
$this->assertTrue($Controller->_afterScaffoldSave(''));
$this->assertTrue($Controller->_afterScaffoldSaveError(''));
@@ -1119,7 +1120,7 @@ public function testRequestHandlerPrefers(){
$request = new CakeRequest('controller_posts/index');
- $Controller = new Controller($request);
+ $Controller = new Controller($request, $this->getMock('CakeResponse'));
$Controller->components = array("RequestHandler");
$Controller->modelClass='ControllerPost';
@@ -1140,8 +1141,8 @@ public function testRequestHandlerPrefers(){
* @return void
*/
public function testControllerHttpCodes() {
- $Controller = new Controller(null);
- $Controller->response = $this->getMock('CakeResponse', array('httpCodes'));
+ $response = $this->getMock('CakeResponse', array('httpCodes'));
+ $Controller = new Controller(null, $response);
$Controller->response->expects($this->at(0))->method('httpCodes')->with(null);
$Controller->response->expects($this->at(1))->method('httpCodes')->with(100);
$Controller->httpCodes();
@@ -1237,8 +1238,9 @@ public function testPropertyCompatibilityAndModelsComponents() {
public function testPaginateBackwardsCompatibility() {
$request = new CakeRequest('controller_posts/index');
$request->params['pass'] = $request->params['named'] = array();
+ $response = $this->getMock('CakeResponse', array('httpCodes'));
- $Controller = new Controller($request);
+ $Controller = new Controller($request, $response);
$Controller->uses = array('ControllerPost', 'ControllerComment');
$Controller->passedArgs[] = '1';
$Controller->params['url'] = array();
Please sign in to comment.
Something went wrong with that request. Please try again.