Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Updating Dispatcher test to run correctly in CLI.
  • Loading branch information
markstory committed Sep 25, 2010
1 parent cdda1bf commit d6b747c
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions cake/tests/cases/dispatcher.test.php
Expand Up @@ -18,13 +18,25 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
require_once CAKE . 'dispatcher.php';
App::import('Core', 'CakeResponse', false);

if (!class_exists('AppController')) {
require_once LIBS . 'controller' . DS . 'app_controller.php';
} elseif (!defined('APP_CONTROLLER_EXISTS')){
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
*
Expand All @@ -50,16 +62,6 @@ protected function _invoke(&$controller, $params) {
return $controller;
}

/**
* cakeError method
*
* @param mixed $filename
* @return void
*/
public function cakeError($filename, $params) {
return array($filename, $params);
}

/**
* _stop method
*
Expand All @@ -69,15 +71,6 @@ protected function _stop() {
$this->stopped = true;
return true;
}

/**
* header method
*
* @return void
*/
public function header() {

}
}

/**
Expand Down Expand Up @@ -451,6 +444,13 @@ class TestCachedPagesController extends AppController {
'view' => '+2 sec'
);

/**
* Mock out the reponse object so it doesn't send headers.
*
* @var string
*/
protected $_responseClass = 'DispatcherMockCakeResponse';

/**
* viewPath property
*
Expand Down Expand Up @@ -1471,7 +1471,6 @@ public function testFullPageCachingDispatch() {
), true);

$dispatcher = new TestDispatcher();
$dispatcher->response = $this->getMock('CakeResponse', array('_sendHeader'));
$url = '/';

ob_start();
Expand Down

0 comments on commit d6b747c

Please sign in to comment.