Browse Source

Add test for disabled modulus.

Mark Scherer 10 years ago
parent
commit
00735936dd
1 changed files with 32 additions and 2 deletions
  1. 32 2
      tests/TestCase/View/Helper/PaginatorHelperTest.php

+ 32 - 2
tests/TestCase/View/Helper/PaginatorHelperTest.php

@@ -1379,8 +1379,8 @@ class PaginatorHelperTest extends TestCase
                 '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',
@@ -1550,6 +1550,36 @@ class PaginatorHelperTest extends TestCase
     }
 
     /**
+     * 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.
      *
      * @return void