Skip to content
Permalink
Browse files

Fix failing test.

  • Loading branch information...
markstory committed Apr 29, 2012
1 parent 2f2466e commit 6406e528f07923ccd357762eed3e87e58ef97af6
Showing with 14 additions and 4 deletions.
  1. +3 −1 lib/Cake/Routing/Route/RedirectRoute.php
  2. +11 −3 lib/Cake/Test/TestCase/Routing/RouterTest.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();
@@ -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());
}

0 comments on commit 6406e52

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