Correcting how parameters and default values are merged in Controller::paginate(), fixes #5503

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7688 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-10-02 00:46:26 +00:00
parent 915a1e119d
commit 300dbc5e91
2 changed files with 9 additions and 1 deletions

View file

@ -985,7 +985,7 @@ class Controller extends Object {
if (isset($defaults[0])) {
$type = array_shift($defaults);
}
$extra = array_diff_assoc($defaults, compact(
$extra = array_diff_key($defaults, compact(
'conditions', 'fields', 'order', 'limit', 'page', 'recursive'
));
if ($type !== 'all') {

View file

@ -488,6 +488,14 @@ class ControllerTest extends CakeTestCase {
$this->assertEqual(Set::extract($result, '{n}.ControllerPost.id'), array(2, 3));
$this->assertEqual($Controller->ControllerPost->lastQuery['conditions'], array('ControllerPost.id > ' => '1'));
$Controller->passedArgs = array('limit' => 12);
$Controller->paginate = array('limit' => 30);
$result = $Controller->paginate('ControllerPost');
$paging = $Controller->params['paging']['ControllerPost'];
$this->assertEqual($Controller->ControllerPost->lastQuery['limit'], 12);
$this->assertEqual($paging['options']['limit'], 12);
$Controller =& new Controller();
$Controller->uses = array('ControllerPaginateModel');
$Controller->params['url'] = array();