diff --git a/lib/Cake/Routing/Route/RedirectRoute.php b/lib/Cake/Routing/Route/RedirectRoute.php index abfb24c2dcc..de926701190 100644 --- a/lib/Cake/Routing/Route/RedirectRoute.php +++ b/lib/Cake/Routing/Route/RedirectRoute.php @@ -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(); diff --git a/lib/Cake/Test/TestCase/Routing/RouterTest.php b/lib/Cake/Test/TestCase/Routing/RouterTest.php index 85c94901d9e..a1064b7a190 100644 --- a/lib/Cake/Test/TestCase/Routing/RouterTest.php +++ b/lib/Cake/Test/TestCase/Routing/RouterTest.php @@ -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']); @@ -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()); }