Skip to content

Commit 23c860c

Browse files
author
euromark
committed
fix tests for cake2.4
1 parent b13b9d3 commit 23c860c

2 files changed

Lines changed: 35 additions & 5 deletions

File tree

Test/Case/View/Helper/BoostCakePaginatorHelperTest.php

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,23 @@ public function testPaginationTwoModel() {
9292
),
9393
'paramType' => 'named'
9494
);
95+
9596
$result = $this->Paginator->pagination(array(
9697
'model' => 'Article',
9798
'div' => 'pagination'
9899
));
100+
101+
$version = (float)Configure::version();
102+
$pageOne = '/index/page:1';
103+
if ($version >= 2.4) {
104+
$pageOne = '/';
105+
}
106+
99107
$this->assertTags($result, array(
100108
'div' => array('class' => 'pagination'),
101109
'ul' => array(),
102110
array('li' => array('class' => 'disabled')),
103-
array('a' => array('href' => '/index/page:1')),
111+
array('a' => array('href' => $pageOne)),
104112
'<',
105113
'/a',
106114
'/li',
@@ -150,11 +158,18 @@ public function testPaginationTwo() {
150158
'model' => 'Post',
151159
'div' => 'pagination'
152160
));
161+
162+
$version = (float)Configure::version();
163+
$pageOne = '/index/page:1';
164+
if ($version >= 2.4) {
165+
$pageOne = '/';
166+
}
167+
153168
$this->assertTags($result, array(
154169
'div' => array('class' => 'pagination'),
155170
'ul' => array(),
156171
array('li' => array('class' => 'disabled')),
157-
array('a' => array('href' => '/index/page:1')),
172+
array('a' => array('href' => $pageOne)),
158173
'<',
159174
'/a',
160175
'/li',
@@ -181,10 +196,17 @@ public function testPaginationTwo() {
181196
'model' => 'Post',
182197
'ul' => 'pagination'
183198
));
199+
200+
$version = (float)Configure::version();
201+
$pageOne = '/index/page:1';
202+
if ($version >= 2.4) {
203+
$pageOne = '/';
204+
}
205+
184206
$this->assertTags($result, array(
185207
'ul' => array('class' => 'pagination'),
186208
array('li' => array('class' => 'disabled')),
187-
array('a' => array('href' => '/index/page:1')),
209+
array('a' => array('href' => $pageOne)),
188210
'<',
189211
'/a',
190212
'/li',
@@ -312,9 +334,16 @@ public function testNumbersElipsis() {
312334
'first' => 1,
313335
'last' => 1,
314336
));
337+
338+
$version = (float)Configure::version();
339+
$pageOne = '/index/page:1';
340+
if ($version >= 2.4) {
341+
$pageOne = '/';
342+
}
343+
315344
$this->assertTags($result, array(
316345
array('li' => array()),
317-
array('a' => array('href' => '/index/page:1')),
346+
array('a' => array('href' => $pageOne)),
318347
'1',
319348
'/a',
320349
'/li',

View/Helper/BoostCakePaginatorHelper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public function pagination($options = array()) {
1515
if ($pageCount < 2) {
1616
// Don't display pagination if there is only one page
1717
return '';
18-
} else if ($pageCount == 2) {
18+
}
19+
if ($pageCount == 2) {
1920
// If only two pages, don't show duplicate prev/next buttons
2021
$default['units'] = array('prev', 'numbers', 'next');
2122
} else {

0 commit comments

Comments
 (0)