Making more tests pass with the named parameter changes.

This commit is contained in:
mark_story 2010-12-19 17:38:21 -05:00
parent 51e2b16d46
commit 4c3736a68a
4 changed files with 10 additions and 10 deletions

View file

@ -539,7 +539,7 @@ class HttpSocket extends CakeSocket {
if (!method_exists($authClass, 'authentication')) {
throw new SocketException(sprintf(__('The %s do not support authentication.'), $authClass));
}
call_user_func("$authClass::authentication", $this, $this->_auth[$method]);
call_user_func_array("$authClass::authentication", array($this, &$this->_auth[$method]));
}
/**
@ -565,7 +565,7 @@ class HttpSocket extends CakeSocket {
if (!method_exists($authClass, 'proxyAuthentication')) {
throw new SocketException(sprintf(__('The %s do not support proxy authentication.'), $authClass));
}
call_user_func("$authClass::proxyAuthentication", $this, $this->_proxy);
call_user_func_array("$authClass::proxyAuthentication", array($this, &$this->_proxy));
}
/**

View file

@ -70,16 +70,15 @@ class RedirectRoute extends CakeRoute {
}
if (isset($this->options['persist']) && is_array($redirect)) {
$argOptions['context'] = array('action' => $redirect['action'], 'controller' => $redirect['controller']);
$args = Router::getArgs($params['_args_'], $argOptions);
$redirect += $args['pass'];
$redirect += $args['named'];
$redirect += Router::getArgs($params['_args_'], $argOptions) + array('url' => array());
$redirect = Router::reverse($redirect);
}
$status = 301;
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->statusCode($status);
$this->response->statusCode($status);
$this->response->send();
}

View file

@ -1266,7 +1266,8 @@ class ControllerTest extends CakeTestCase {
$Controller->passedArgs[] = '1';
$Controller->params['url'] = array();
$Controller->constructClasses();
$this->assertEqual($Controller->paginate, array('page' => 1, 'limit' => 20));
$expected = array('page' => 1, 'limit' => 20, 'maxLimit' => 100, 'paramType' => 'named');
$this->assertEqual($Controller->paginate, $expected);
$results = Set::extract($Controller->paginate('ControllerPost'), '{n}.ControllerPost.id');
$this->assertEqual($results, array(1, 2, 3));

View file

@ -477,7 +477,7 @@ class HelperTest extends CakeTestCase {
$result = $this->Helper->url('/controller/action/1?one=1&two=2');
$this->assertEqual($result, '/controller/action/1?one=1&amp;two=2');
$result = $this->Helper->url(array('controller' => 'posts', 'action' => 'index', 'page' => '1" onclick="alert(\'XSS\');"'));
$result = $this->Helper->url(array('controller' => 'posts', 'action' => 'index', ':page' => '1" onclick="alert(\'XSS\');"'));
$this->assertEqual($result, "/posts/index/page:1&quot; onclick=&quot;alert(&#039;XSS&#039;);&quot;");
$result = $this->Helper->url('/controller/action/1/param:this+one+more');
@ -490,12 +490,12 @@ class HelperTest extends CakeTestCase {
$this->assertEqual($result, '/controller/action/1/param:%7Baround%20here%7D%5Bthings%5D%5Bare%5D%24%24');
$result = $this->Helper->url(array(
'controller' => 'posts', 'action' => 'index', 'param' => '%7Baround%20here%7D%5Bthings%5D%5Bare%5D%24%24'
'controller' => 'posts', 'action' => 'index', ':param' => '%7Baround%20here%7D%5Bthings%5D%5Bare%5D%24%24'
));
$this->assertEqual($result, "/posts/index/param:%7Baround%20here%7D%5Bthings%5D%5Bare%5D%24%24");
$result = $this->Helper->url(array(
'controller' => 'posts', 'action' => 'index', 'page' => '1',
'controller' => 'posts', 'action' => 'index', ':page' => '1',
'?' => array('one' => 'value', 'two' => 'value', 'three' => 'purple')
));
$this->assertEqual($result, "/posts/index/page:1?one=value&amp;two=value&amp;three=purple");