Making paging params match those that would be generated by PaginatorComponent.

This commit is contained in:
mark_story 2010-12-19 13:09:52 -05:00
parent 8c3ceff50d
commit 176d5520f6

View file

@ -53,8 +53,6 @@ class PaginatorHelperTest extends CakeTestCase {
'nextPage' => true, 'nextPage' => true,
'pageCount' => 7, 'pageCount' => 7,
'options' => array( 'options' => array(
'order' => array('Article.date' => 'asc'),
'limit' => 9,
'page' => 1, 'page' => 1,
'conditions' => array() 'conditions' => array()
) )
@ -138,6 +136,21 @@ class PaginatorHelperTest extends CakeTestCase {
array('base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/') array('base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/')
)); ));
$this->Paginator->options(array('url' => array('param'))); $this->Paginator->options(array('url' => array('param')));
$this->Paginator->request['paging'] = array(
'Article' => array(
'current' => 9,
'count' => 62,
'prevPage' => false,
'nextPage' => true,
'pageCount' => 7,
'options' => array(
'page' => 1,
'order' => array('date' => 'asc'),
'conditions' => array()
)
)
);
$result = $this->Paginator->sort('title'); $result = $this->Paginator->sort('title');
$expected = array( $expected = array(
'a' => array('href' => '/officespace/accounts/index/param/page:1/sort:title/direction:asc'), 'a' => array('href' => '/officespace/accounts/index/param/page:1/sort:title/direction:asc'),
@ -645,7 +658,9 @@ class PaginatorHelperTest extends CakeTestCase {
'page' => 1, 'current' => 3, 'count' => 13, 'page' => 1, 'current' => 3, 'count' => 13,
'prevPage' => false, 'nextPage' => true, 'pageCount' => 8, 'prevPage' => false, 'nextPage' => true, 'pageCount' => 8,
'options' => array( 'options' => array(
'page' => 1, 'limit' => 3, 'order' => array(), 'conditions' => array() 'page' => 1,
'order' => array(),
'conditions' => array()
) )
) )
); );
@ -708,9 +723,6 @@ class PaginatorHelperTest extends CakeTestCase {
'pageCount' => 5, 'pageCount' => 5,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -792,9 +804,6 @@ class PaginatorHelperTest extends CakeTestCase {
'pageCount' => 5, 'pageCount' => 5,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -834,8 +843,7 @@ class PaginatorHelperTest extends CakeTestCase {
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3, 'limit' => 3,
'order' => array('Client.name' => 'DESC'), 'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -873,7 +881,7 @@ class PaginatorHelperTest extends CakeTestCase {
'options' => array( 'options' => array(
'page' => 2, 'page' => 2,
'limit' => 10, 'limit' => 10,
'order' => array(), 'order' => array(),
'conditions' => array() 'conditions' => array()
) )
) )
@ -926,7 +934,7 @@ class PaginatorHelperTest extends CakeTestCase {
'nextPage' => true, 'nextPage' => true,
'pageCount' => 5, 'pageCount' => 5,
'options' => array( 'options' => array(
'page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array() 'page' => 1,
) )
) )
); );
@ -969,9 +977,6 @@ class PaginatorHelperTest extends CakeTestCase {
'pageCount' => 5, 'pageCount' => 5,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
), ),
'Server' => array( 'Server' => array(
@ -983,9 +988,6 @@ class PaginatorHelperTest extends CakeTestCase {
'pageCount' => 5, 'pageCount' => 5,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 5,
'order' => array('Server.name' => 'ASC'),
'conditions' => array()
) )
) )
); );
@ -1094,10 +1096,7 @@ class PaginatorHelperTest extends CakeTestCase {
'nextPage' => 2, 'nextPage' => 2,
'pageCount' => 15, 'pageCount' => 15,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -1194,10 +1193,7 @@ class PaginatorHelperTest extends CakeTestCase {
'nextPage' => 2, 'nextPage' => 2,
'pageCount' => 15, 'pageCount' => 15,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -1233,10 +1229,7 @@ class PaginatorHelperTest extends CakeTestCase {
'nextPage' => 2, 'nextPage' => 2,
'pageCount' => 15, 'pageCount' => 15,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -1271,10 +1264,7 @@ class PaginatorHelperTest extends CakeTestCase {
'nextPage' => 2, 'nextPage' => 2,
'pageCount' => 9, 'pageCount' => 9,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -1332,10 +1322,7 @@ class PaginatorHelperTest extends CakeTestCase {
'nextPage' => 2, 'nextPage' => 2,
'pageCount' => 15, 'pageCount' => 15,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -1374,10 +1361,7 @@ class PaginatorHelperTest extends CakeTestCase {
'nextPage' => 2, 'nextPage' => 2,
'pageCount' => 15, 'pageCount' => 15,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -1418,9 +1402,6 @@ class PaginatorHelperTest extends CakeTestCase {
'pageCount' => 42, 'pageCount' => 42,
'options' => array( 'options' => array(
'page' => 6, 'page' => 6,
'limit' => 15,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -1460,10 +1441,7 @@ class PaginatorHelperTest extends CakeTestCase {
'nextPage' => 1, 'nextPage' => 1,
'pageCount' => 42, 'pageCount' => 42,
'options' => array( 'options' => array(
'page' => 37, 'page' => 37,
'limit' => 15,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -1502,17 +1480,8 @@ class PaginatorHelperTest extends CakeTestCase {
'prevPage' => false, 'prevPage' => false,
'nextPage' => 2, 'nextPage' => 2,
'pageCount' => 3, 'pageCount' => 3,
'defaults' => array(
'limit' => 3,
'step' => 1,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
),
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -1538,7 +1507,6 @@ class PaginatorHelperTest extends CakeTestCase {
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'order' => array('Client.name' => 'DESC'), 'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -1565,9 +1533,6 @@ class PaginatorHelperTest extends CakeTestCase {
'pageCount' => 4897, 'pageCount' => 4897,
'options' => array( 'options' => array(
'page' => 4894, 'page' => 4894,
'limit' => 10,
'order' => 'Client.name DESC',
'conditions' => array()
) )
) )
); );
@ -1791,12 +1756,7 @@ class PaginatorHelperTest extends CakeTestCase {
'prevPage' => false, 'prevPage' => false,
'nextPage' => 2, 'nextPage' => 2,
'pageCount' => 15, 'pageCount' => 15,
'options' => array( 'options' => array()
'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
)
) )
); );
@ -1814,9 +1774,6 @@ class PaginatorHelperTest extends CakeTestCase {
'pageCount' => 15, 'pageCount' => 15,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -1898,9 +1855,6 @@ class PaginatorHelperTest extends CakeTestCase {
'pageCount' => 15, 'pageCount' => 15,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -1913,14 +1867,12 @@ class PaginatorHelperTest extends CakeTestCase {
'page' => 4, 'page' => 4,
'current' => 3, 'current' => 3,
'count' => 30, 'count' => 30,
'prevPage' => false, 'prevPage' => false,
'nextPage' => 2, 'nextPage' => 2,
'pageCount' => 15, 'pageCount' => 15,
'options' => array( 'options' => array(
'page' => 1, 'page' => 1,
'limit' => 3,
'order' => array('Client.name' => 'DESC'), 'order' => array('Client.name' => 'DESC'),
'conditions' => array()
) )
) )
); );
@ -2139,7 +2091,7 @@ class PaginatorHelperTest extends CakeTestCase {
Router::reload(); Router::reload();
Router::parse('/'); Router::parse('/');
Router::setRequestInfo(array( Router::setRequestInfo(array(
array('plugin' => null, 'controller' => 'accounts', 'action' => 'index', 'pass' => array(), 'url' => array('url' => 'accounts/', 'mod_rewrite' => 'true')), array('plugin' => null, 'controller' => 'accounts', 'action' => 'index', 'pass' => array(), 'url' => array('url' => 'accounts/')),
array('base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/', 'passedArgs' => array()) array('base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/', 'passedArgs' => array())
)); ));