Skip to content

Commit

Permalink
Add test for disabled modulus.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Scherer committed Jul 30, 2015
1 parent d76803b commit 0073593
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions tests/TestCase/View/Helper/PaginatorHelperTest.php
Expand Up @@ -1379,8 +1379,8 @@ public function testNumbersModulus()
'pageCount' => 3,
]
];
$options = ['modulus' => 10];
$result = $this->Paginator->numbers($options);

$result = $this->Paginator->numbers(['modulus' => 10]);
$expected = [
['li' => ['class' => 'active']], '<a href=""', '1', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=2']], '2', '/a', '/li',
Expand Down Expand Up @@ -1549,6 +1549,36 @@ public function testNumbersModulus()
$this->assertHtml($expected, $result);
}

/**
* Tests that disabling modulus displays all page links.
*
* @return void
*/
public function testModulusDisabled()
{
$this->Paginator->request->params['paging'] = [
'Client' => [
'page' => 4,
'current' => 2,
'count' => 30,
'prevPage' => 1,
'nextPage' => 1,
'pageCount' => 6,
]
];

$result = $this->Paginator->numbers(['modulus' => false]);
$expected = [
['li' => []], '<a href="/index"', '1', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=2']], '2', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=3']], '3', '/a', '/li',
['li' => ['class' => 'active']], ['a' => ['href' => '']], '4', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=5']], '5', '/a', '/li',
['li' => []], ['a' => ['href' => '/index?page=6']], '6', '/a', '/li',
];
$this->assertHtml($expected, $result);
}

/**
* Test that numbers() with url options.
*
Expand Down

0 comments on commit 0073593

Please sign in to comment.