File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,74 @@ public function testPaginationEmpty() {
5656 $ this ->assertSame ('' , $ numbers );
5757 }
5858
59+ /**
60+ * testPaginationTwoModel
61+ *
62+ * @return void
63+ */
64+ public function testPaginationTwoModel () {
65+ $ this ->Paginator ->request ->params ['paging ' ]['Post ' ] = array (
66+ 'page ' => 1 ,
67+ 'current ' => 0 ,
68+ 'count ' => 0 ,
69+ 'prevPage ' => false ,
70+ 'nextPage ' => false ,
71+ 'pageCount ' => 1 ,
72+ 'order ' => null ,
73+ 'limit ' => 20 ,
74+ 'options ' => array (
75+ 'page ' => 1 ,
76+ 'conditions ' => array ()
77+ ),
78+ 'paramType ' => 'named '
79+ );
80+ $ this ->Paginator ->request ->params ['paging ' ]['Article ' ] = array (
81+ 'page ' => 1 ,
82+ 'current ' => 0 ,
83+ 'count ' => 40 ,
84+ 'prevPage ' => false ,
85+ 'nextPage ' => true ,
86+ 'pageCount ' => 2 ,
87+ 'order ' => null ,
88+ 'limit ' => 20 ,
89+ 'options ' => array (
90+ 'page ' => 1 ,
91+ 'conditions ' => array ()
92+ ),
93+ 'paramType ' => 'named '
94+ );
95+ $ result = $ this ->Paginator ->pagination (array (
96+ 'model ' => 'Article ' ,
97+ 'div ' => 'pagination '
98+ ));
99+ $ this ->assertTags ($ result , array (
100+ 'div ' => array ('class ' => 'pagination ' ),
101+ 'ul ' => array (),
102+ array ('li ' => array ('class ' => 'disabled ' )),
103+ array ('a ' => array ('href ' => '/index/page:1 ' )),
104+ '< ' ,
105+ '/a ' ,
106+ '/li ' ,
107+ array ('li ' => array ('class ' => 'current disabled ' )),
108+ array ('a ' => array ('href ' => '# ' )),
109+ '1 ' ,
110+ '/a ' ,
111+ '/li ' ,
112+ array ('li ' => array ()),
113+ array ('a ' => array ('href ' => '/index/page:2 ' )),
114+ '2 ' ,
115+ '/a ' ,
116+ '/li ' ,
117+ array ('li ' => array ()),
118+ array ('a ' => array ('href ' => '/index/page:2 ' , 'rel ' => 'next ' )),
119+ '> ' ,
120+ '/a ' ,
121+ '/li ' ,
122+ '/ul ' ,
123+ '/div '
124+ ));
125+ }
126+
59127/**
60128 * testPaginationTwo
61129 *
Original file line number Diff line number Diff line change @@ -9,9 +9,9 @@ public function pagination($options = array()) {
99 'ul ' => ''
1010 );
1111
12- $ pagingParams = reset ($ this ->request ->params ['paging ' ]);
13- $ pageCount = $ pagingParams ['pageCount ' ];
12+ $ model = (empty ($ options ['model ' ])) ? $ this ->defaultModel () : $ options ['model ' ];
1413
14+ $ pageCount = $ this ->request ->params ['paging ' ][$ model ]['pageCount ' ];
1515 if ($ pageCount < 2 ) {
1616 // Don't display pagination if there is only one page
1717 return '' ;
You can’t perform that action at this time.
0 commit comments