Updating Dispatcher test to run correctly in CLI.

This commit is contained in:
mark_story 2010-09-19 00:24:02 -04:00
parent cdda1bfb17
commit d6b747cb25

View file

@ -18,6 +18,7 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/ */
require_once CAKE . 'dispatcher.php'; require_once CAKE . 'dispatcher.php';
App::import('Core', 'CakeResponse', false);
if (!class_exists('AppController')) { if (!class_exists('AppController')) {
require_once LIBS . 'controller' . DS . 'app_controller.php'; require_once LIBS . 'controller' . DS . 'app_controller.php';
@ -25,6 +26,17 @@ if (!class_exists('AppController')) {
define('APP_CONTROLLER_EXISTS', true); define('APP_CONTROLLER_EXISTS', true);
} }
/**
* A testing stub that doesn't send headers.
*
* @package cake.tests.cases
*/
class DispatcherMockCakeResponse extends CakeResponse {
protected function _sendHeader($name, $value = null) {
return $name . ' ' . $value;
}
}
/** /**
* TestDispatcher class * TestDispatcher class
* *
@ -50,16 +62,6 @@ class TestDispatcher extends Dispatcher {
return $controller; return $controller;
} }
/**
* cakeError method
*
* @param mixed $filename
* @return void
*/
public function cakeError($filename, $params) {
return array($filename, $params);
}
/** /**
* _stop method * _stop method
* *
@ -69,15 +71,6 @@ class TestDispatcher extends Dispatcher {
$this->stopped = true; $this->stopped = true;
return true; return true;
} }
/**
* header method
*
* @return void
*/
public function header() {
}
} }
/** /**
@ -451,6 +444,13 @@ class TestCachedPagesController extends AppController {
'view' => '+2 sec' 'view' => '+2 sec'
); );
/**
* Mock out the reponse object so it doesn't send headers.
*
* @var string
*/
protected $_responseClass = 'DispatcherMockCakeResponse';
/** /**
* viewPath property * viewPath property
* *
@ -1471,7 +1471,6 @@ class DispatcherTest extends CakeTestCase {
), true); ), true);
$dispatcher = new TestDispatcher(); $dispatcher = new TestDispatcher();
$dispatcher->response = $this->getMock('CakeResponse', array('_sendHeader'));
$url = '/'; $url = '/';
ob_start(); ob_start();