Skip to content

Commit

Permalink
Adding return to RequestHandlerComponent::accepts() as it was missing.
Browse files Browse the repository at this point in the history
Updating RequestHandlerComponent tests to work with PHPUnit.
  • Loading branch information
markstory committed Jun 9, 2010
1 parent dad4b5a commit c5e4ab2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions cake/libs/controller/components/request_handler.php
Expand Up @@ -521,6 +521,7 @@ function accepts($type = null) {
}
}
}
return false;
}

/**
Expand Down
Expand Up @@ -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
*
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -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);
Expand Down

0 comments on commit c5e4ab2

Please sign in to comment.