Skip to content

Commit

Permalink
Fixing controller test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 28, 2010
1 parent 9485f0a commit dcb7a16
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions cake/tests/cases/libs/controller/controller.test.php
Expand Up @@ -1035,8 +1035,7 @@ function testRedirectByCode($code, $msg) {
$Controller = new Controller(null);
$Controller->response = $this->getMock('CakeResponse', array('header', 'statusCode'));

$Controller->Component = new Component();
$Controller->Component->init($Controller);
$Controller->Components = $this->getMock('ComponentCollection');

$Controller->response->expects($this->once())->method('statusCode')
->with($code);
Expand Down Expand Up @@ -1077,7 +1076,7 @@ function testRedirectByMessage($code, $msg) {
function testRedirectTriggeringComponentsReturnNull() {
$Controller = new Controller(null);
$Controller->response = $this->getMock('CakeResponse', array('header', 'statusCode'));
$Controller->Component = $this->getMock('Component');
$Controller->Components = $this->getMock('ComponentCollection');

$Controller->Components->expects($this->once())->method('trigger')
->will($this->returnValue(null));
Expand All @@ -1099,7 +1098,7 @@ function testRedirectTriggeringComponentsReturnNull() {
function testRedirectBeforeRedirectModifyingParams() {
$Controller = new Controller(null);
$Controller->response = $this->getMock('CakeResponse', array('header', 'statusCode'));
$Controller->Component = $this->getMock('Component');
$Controller->Components = $this->getMock('ComponentCollection');

$Controller->Components->expects($this->once())->method('trigger')
->will($this->returnValue(array('http://book.cakephp.org')));
Expand Down Expand Up @@ -1136,11 +1135,11 @@ function testRedirectBeforeRedirectModifyingParamsArrayReturn() {
$Controller->Components->expects($this->once())->method('trigger')
->will($this->returnValue($return));

$Controller->expects($this->at(0))->method('header')
->with('HTTP/1.1 302 Found');
$Controller->response->expects($this->at(0))->method('header')
->with('Location', 'http://example.com/test/2');

$Controller->expects($this->at(1))->method('header')
->with('Location: http://example.com/test/2');
$Controller->response->expects($this->at(1))->method('statusCode')
->with(302);

$Controller->expects($this->never())->method('_stop');
$Controller->redirect('http://cakephp.org', 301);
Expand Down Expand Up @@ -1438,16 +1437,15 @@ function testRequestHandlerPrefers(){
$Controller->modelClass='ControllerPost';
$Controller->params['url'] = array('ext' => 'rss');
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
$Controller->Components->trigger('initialize', array(&$Controller));
$Controller->beforeFilter();
$Controller->Component->startup($Controller);
$Controller->Components->trigger('startup', array(&$Controller));

$this->assertEqual($Controller->RequestHandler->prefers(), 'rss');
unset($Controller);
}

/**
>>>>>>> 2.0-request
* testControllerHttpCodes method
*
* @access public
Expand Down

0 comments on commit dcb7a16

Please sign in to comment.