Skip to content
Permalink
Browse files

Adding return to RequestHandlerComponent::accepts() as it was missing.

Updating RequestHandlerComponent tests to work with PHPUnit.
  • Loading branch information...
markstory committed Jun 9, 2010
1 parent dad4b5a commit c5e4ab2366b38615207078a3f8757d14a4faff05
@@ -521,6 +521,7 @@ function accepts($type = null) {
}
}
}
return false;
}
/**
@@ -20,9 +20,6 @@
App::import('Controller', 'Controller', false);
App::import('Component', array('RequestHandler'));
Mock::generatePartial('RequestHandlerComponent', 'NoStopRequestHandler', array('_stop'));
Mock::generatePartial('Controller', 'RequestHandlerMockController', array('header'));
/**
* RequestHandlerTestController class
*
@@ -578,8 +575,8 @@ function testAjaxRedirectAsRequestAction() {
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
), true);
$this->Controller->RequestHandler = new NoStopRequestHandler($this);
$this->Controller->RequestHandler->expectOnce('_stop');
$this->Controller->RequestHandler = $this->getMock('RequestHandlerComponent', array('_stop'));
$this->Controller->RequestHandler->expects($this->once())->method('_stop');
ob_start();
$this->Controller->RequestHandler->beforeRedirect(
@@ -608,7 +605,7 @@ function testBeforeRedirectCallbackWithArrayUrl() {
array('base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/')
));
$RequestHandler =& new NoStopRequestHandler();
$RequestHandler = $this->getMock('RequestHandlerComponent', array('_stop'));
ob_start();
$RequestHandler->beforeRedirect(
@@ -625,10 +622,12 @@ function testBeforeRedirectCallbackWithArrayUrl() {
* @return void
*/
function testBeforeRedirectCallingHeader() {
$controller =& new RequestHandlerMockController();
$RequestHandler =& new NoStopRequestHandler();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
$controller = $this->getMock('Controller', array('header'));
$RequestHandler = $this->getMock('RequestHandlerComponent', array('_stop'));
$controller->expectOnce('header', array('HTTP/1.1 403 Forbidden'));
$controller->expects($this->once())->method('header')->with('HTTP/1.1 403 Forbidden');
ob_start();
$RequestHandler->beforeRedirect($controller, 'request_handler_test/param_method/first/second', 403);

0 comments on commit c5e4ab2

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