diff --git a/cake/libs/view/helpers/paginator.php b/cake/libs/view/helpers/paginator.php index 96541758cb4..90b9d4b19dd 100644 --- a/cake/libs/view/helpers/paginator.php +++ b/cake/libs/view/helpers/paginator.php @@ -304,7 +304,7 @@ function __pagingLink($which, $title = null, $options = array(), $disabledTitle $options = array_merge($_defaults, (array)$options); $paging = $this->params($options['model']); - if (!$this->{$check}() && (!empty($disabledTitle) || !empty($disabledOptions))) { + if (!$this->{$check}($options['model']) && (!empty($disabledTitle) || !empty($disabledOptions))) { if (!empty($disabledTitle) && $disabledTitle !== true) { $title = $disabledTitle; } diff --git a/cake/tests/cases/libs/view/helpers/paginator.test.php b/cake/tests/cases/libs/view/helpers/paginator.test.php index 8215726637c..cef1ccea437 100644 --- a/cake/tests/cases/libs/view/helpers/paginator.test.php +++ b/cake/tests/cases/libs/view/helpers/paginator.test.php @@ -402,6 +402,35 @@ function testPagingLinks() { ); $this->assertTags($result, $expected); } +/** + * testPagingLinksNotDefaultModel + * + * Test the creation of paging links when the non default model is used. + * + * @access public + * @return void + */ + function testPagingLinksNotDefaultModel() { + // Multiple Model Paginate + $this->Paginator->params['paging'] = array( + 'Client' => array( + 'page' => 1, 'current' => 3, 'count' => 13, 'prevPage' => false, 'nextPage' => true, 'pageCount' => 5, + 'defaults' => array( 'limit'=>3, 'order' => array('Client.name' => 'DESC')), + 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()) + ), + 'Server' => array( + 'page' => 1, 'current' => 1, 'count' => 5, 'prevPage' => false, 'nextPage' => false, 'pageCount' => 5, + 'defaults' => array(), + 'options' => array('page' => 1, 'limit' => 5, 'order' => array('Server.name' => 'ASC'), 'conditions' => array()) + ) + ); + $result = $this->Paginator->next('Next', array('model' => 'Client')); + $this->assertPattern('/^]+>Next<\/a>$/', $result); + $this->assertPattern('/href="\/index\/page:2"/', $result); // These is passed. + + $result = $this->Paginator->next('Next', array('model' => 'Server'), 'No Next', array('model' => 'Server')); + $this->assertPattern('/^
No Next<\/div>$/', $result); + } /** * testGenericLinks method *