Skip to content

Commit

Permalink
Fix failing test.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 4, 2012
1 parent 2f2466e commit 6406e52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/Cake/Routing/Route/RedirectRoute.php
Expand Up @@ -87,7 +87,9 @@ public function parse($url) {
if (isset($this->options['status']) && ($this->options['status'] >= 300 && $this->options['status'] < 400)) {
$status = $this->options['status'];
}
$this->response->header(array('Location' => Router::url($redirect, true)));
$this->response->header(array(
'Location' => Router::url($redirect, true)
));
$this->response->statusCode($status);
$this->response->send();
$this->_stop();
Expand Down
14 changes: 11 additions & 3 deletions lib/Cake/Test/TestCase/Routing/RouterTest.php
Expand Up @@ -2049,9 +2049,14 @@ public function testRouteRedirection() {
Router::setRouteCollection($routes);

Router::redirect('/blog', array('controller' => 'posts'), array('status' => 302));
$this->assertEquals(1, count($routes));
Router::connect('/:controller', array('action' => 'index'));

$this->assertEquals(2, count($routes));

$routes->get(0)->response = $this->getMock('Cake\Network\Response', array('_sendHeader'));
$routes->get(0)->response = $this->getMock(
'Cake\Network\Response',
array('_sendHeader')
);
$routes->get(0)->stop = false;
$this->assertEquals(302, $routes->get(0)->options['status']);

Expand All @@ -2060,7 +2065,10 @@ public function testRouteRedirection() {
$this->assertEquals(Router::url('/posts', true), $header['Location']);
$this->assertEquals(302, $routes->get(0)->response->statusCode());

$routes->get(0)->response = $this->getMock('Cake\Network\Response', array('_sendHeader'));
$routes->get(0)->response = $this->getMock(
'Cake\Network\Response',
array('_sendHeader')
);
Router::parse('/not-a-match');
$this->assertEquals(array(), $routes->get(0)->response->header());
}
Expand Down

0 comments on commit 6406e52

Please sign in to comment.