diff --git a/cake/libs/view/helpers/paginator.php b/cake/libs/view/helpers/paginator.php index 69da3a24a17..6f714564389 100644 --- a/cake/libs/view/helpers/paginator.php +++ b/cake/libs/view/helpers/paginator.php @@ -357,11 +357,10 @@ public function link($title, $url = array(), $options = array()) { $url = array_merge((array)$options['url'], (array)$url); unset($options['url']); } + $url = $this->url($url, true, $model); $obj = isset($options['update']) ? $this->_ajaxHelperClass : 'Html'; - $url = array_merge(array('page' => $this->current($model)), $url); - $url = array_merge(Set::filter($url, true), array_intersect_key($url, array('plugin' => true))); return $this->{$obj}->link($title, $url, $options); } diff --git a/cake/tests/cases/libs/view/helpers/paginator.test.php b/cake/tests/cases/libs/view/helpers/paginator.test.php index 54602424f57..2bad399f492 100644 --- a/cake/tests/cases/libs/view/helpers/paginator.test.php +++ b/cake/tests/cases/libs/view/helpers/paginator.test.php @@ -2199,4 +2199,36 @@ function testQuerystringUrlGeneration() { $this->assertEquals($expected, $result); } +/** + * test querystring paging link. + * + * @return void + */ + function testQuerystringNextAndPrev() { + $this->Paginator->request->params['paging']['Article']['paramType'] = 'querystring'; + $this->Paginator->request->params['paging']['Article']['page'] = 2; + $this->Paginator->request->params['paging']['Article']['nextPage'] = true; + $this->Paginator->request->params['paging']['Article']['prevPage'] = true; + + $result = $this->Paginator->next('Next'); + $expected = array( + ' array('href' => '/?page=3', 'class' => 'next'), + 'Next', + '/a', + '/span' + ); + $this->assertTags($result, $expected); + + $result = $this->Paginator->prev('Prev'); + $expected = array( + ' array('href' => '/?page=1', 'class' => 'prev'), + 'Prev', + '/a', + '/span' + ); + $this->assertTags($result, $expected); + } + }