Updating PaginatorHelper and its test cases to use the request object.

This commit is contained in:
Mark Story 2010-05-14 00:32:56 -04:00
parent c5dfd128fb
commit 3983bf318d
2 changed files with 118 additions and 115 deletions
cake
libs/view/helpers
tests/cases/libs/view/helpers

View file

@ -107,7 +107,7 @@ class PaginatorHelper extends AppHelper {
* @return void * @return void
*/ */
public function beforeRender() { public function beforeRender() {
$this->options['url'] = array_merge($this->params['pass'], $this->params['named']); $this->options['url'] = array_merge($this->request->params['pass'], $this->request->params['named']);
parent::beforeRender(); parent::beforeRender();
} }
@ -122,10 +122,10 @@ class PaginatorHelper extends AppHelper {
if (empty($model)) { if (empty($model)) {
$model = $this->defaultModel(); $model = $this->defaultModel();
} }
if (!isset($this->params['paging']) || empty($this->params['paging'][$model])) { if (!isset($this->request->params['paging']) || empty($this->request->params['paging'][$model])) {
return null; return null;
} }
return $this->params['paging'][$model]; return $this->request->params['paging'][$model];
} }
/** /**
@ -141,20 +141,20 @@ class PaginatorHelper extends AppHelper {
} }
if (!empty($options['paging'])) { if (!empty($options['paging'])) {
if (!isset($this->params['paging'])) { if (!isset($this->request->params['paging'])) {
$this->params['paging'] = array(); $this->request->params['paging'] = array();
} }
$this->params['paging'] = array_merge($this->params['paging'], $options['paging']); $this->request->params['paging'] = array_merge($this->request->params['paging'], $options['paging']);
unset($options['paging']); unset($options['paging']);
} }
$model = $this->defaultModel(); $model = $this->defaultModel();
if (!empty($options[$model])) { if (!empty($options[$model])) {
if (!isset($this->params['paging'][$model])) { if (!isset($this->request->params['paging'][$model])) {
$this->params['paging'][$model] = array(); $this->request->params['paging'][$model] = array();
} }
$this->params['paging'][$model] = array_merge( $this->request->params['paging'][$model] = array_merge(
$this->params['paging'][$model], $options[$model] $this->request->params['paging'][$model], $options[$model]
); );
unset($options[$model]); unset($options[$model]);
} }
@ -486,10 +486,10 @@ class PaginatorHelper extends AppHelper {
if ($this->__defaultModel != null) { if ($this->__defaultModel != null) {
return $this->__defaultModel; return $this->__defaultModel;
} }
if (empty($this->params['paging'])) { if (empty($this->request->params['paging'])) {
return null; return null;
} }
list($this->__defaultModel) = array_keys($this->params['paging']); list($this->__defaultModel) = array_keys($this->request->params['paging']);
return $this->__defaultModel; return $this->__defaultModel;
} }

View file

@ -37,26 +37,29 @@ class PaginatorHelperTest extends CakeTestCase {
*/ */
function setUp() { function setUp() {
$this->Paginator = new PaginatorHelper(); $this->Paginator = new PaginatorHelper();
$this->Paginator->params['paging'] = array( $this->Paginator->request = new CakeRequest(null, false);
'Article' => array( $this->Paginator->request->addParams(array(
'current' => 9, 'paging' => array(
'count' => 62, 'Article' => array(
'prevPage' => false, 'current' => 9,
'nextPage' => true, 'count' => 62,
'pageCount' => 7, 'prevPage' => false,
'defaults' => array( 'nextPage' => true,
'order' => array('Article.date' => 'asc'), 'pageCount' => 7,
'limit' => 9, 'defaults' => array(
'conditions' => array() 'order' => array('Article.date' => 'asc'),
), 'limit' => 9,
'options' => array( 'conditions' => array()
'order' => array('Article.date' => 'asc'), ),
'limit' => 9, 'options' => array(
'page' => 1, 'order' => array('Article.date' => 'asc'),
'conditions' => array() 'limit' => 9,
'page' => 1,
'conditions' => array()
)
) )
) )
); ));
$this->Paginator->Html = new HtmlHelper(); $this->Paginator->Html = new HtmlHelper();
$this->Paginator->Js = new PaginatorMockJsHelper(); $this->Paginator->Js = new PaginatorMockJsHelper();
@ -82,9 +85,9 @@ class PaginatorHelperTest extends CakeTestCase {
*/ */
function testHasPrevious() { function testHasPrevious() {
$this->assertIdentical($this->Paginator->hasPrev(), false); $this->assertIdentical($this->Paginator->hasPrev(), false);
$this->Paginator->params['paging']['Article']['prevPage'] = true; $this->Paginator->request->params['paging']['Article']['prevPage'] = true;
$this->assertIdentical($this->Paginator->hasPrev(), true); $this->assertIdentical($this->Paginator->hasPrev(), true);
$this->Paginator->params['paging']['Article']['prevPage'] = false; $this->Paginator->request->params['paging']['Article']['prevPage'] = false;
} }
/** /**
@ -95,9 +98,9 @@ class PaginatorHelperTest extends CakeTestCase {
*/ */
function testHasNext() { function testHasNext() {
$this->assertIdentical($this->Paginator->hasNext(), true); $this->assertIdentical($this->Paginator->hasNext(), true);
$this->Paginator->params['paging']['Article']['nextPage'] = false; $this->Paginator->request->params['paging']['Article']['nextPage'] = false;
$this->assertIdentical($this->Paginator->hasNext(), false); $this->assertIdentical($this->Paginator->hasNext(), false);
$this->Paginator->params['paging']['Article']['nextPage'] = true; $this->Paginator->request->params['paging']['Article']['nextPage'] = true;
} }
/** /**
@ -107,13 +110,13 @@ class PaginatorHelperTest extends CakeTestCase {
* @return void * @return void
*/ */
function testDisabledLink() { function testDisabledLink() {
$this->Paginator->params['paging']['Article']['nextPage'] = false; $this->Paginator->request->params['paging']['Article']['nextPage'] = false;
$this->Paginator->params['paging']['Article']['page'] = 1; $this->Paginator->request->params['paging']['Article']['page'] = 1;
$result = $this->Paginator->next('Next', array(), true); $result = $this->Paginator->next('Next', array(), true);
$expected = '<span class="next">Next</span>'; $expected = '<span class="next">Next</span>';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$this->Paginator->params['paging']['Article']['prevPage'] = false; $this->Paginator->request->params['paging']['Article']['prevPage'] = false;
$result = $this->Paginator->prev('prev', array('update' => 'theList', 'indicator' => 'loading', 'url' => array('controller' => 'posts')), null, array('class' => 'disabled', 'tag' => 'span')); $result = $this->Paginator->prev('prev', array('update' => 'theList', 'indicator' => 'loading', 'url' => array('controller' => 'posts')), null, array('class' => 'disabled', 'tag' => 'span'));
$expected = array( $expected = array(
'span' => array('class' => 'disabled'), 'prev', '/span' 'span' => array('class' => 'disabled'), 'prev', '/span'
@ -167,7 +170,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging']['Article']['options']['sort'] = 'title'; $this->Paginator->request->params['paging']['Article']['options']['sort'] = 'title';
$result = $this->Paginator->sort(array('asc' => 'ascending', 'desc' => 'descending'), 'title'); $result = $this->Paginator->sort(array('asc' => 'ascending', 'desc' => 'descending'), 'title');
$expected = array( $expected = array(
'a' => array('href' => '/officespace/accounts/index/param/page:1/sort:title/direction:desc', 'class' => 'asc'), 'a' => array('href' => '/officespace/accounts/index/param/page:1/sort:title/direction:desc', 'class' => 'asc'),
@ -176,37 +179,37 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
$this->Paginator->params['paging']['Article']['options']['sort'] = null; $this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('title'); $result = $this->Paginator->sort('title');
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result); $this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$this->Paginator->params['paging']['Article']['options']['sort'] = null; $this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('title'); $result = $this->Paginator->sort('title');
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result); $this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
$this->Paginator->params['paging']['Article']['options']['sort'] = null; $this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc')); $result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc'));
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result); $this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
$this->Paginator->params['paging']['Article']['options']['sort'] = null; $this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'asc')); $result = $this->Paginator->sort('Title', 'title', array('direction' => 'asc'));
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result); $this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$this->Paginator->params['paging']['Article']['options']['sort'] = null; $this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'asc')); $result = $this->Paginator->sort('Title', 'title', array('direction' => 'asc'));
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result); $this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$this->Paginator->params['paging']['Article']['options']['sort'] = null; $this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc')); $result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc'));
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result); $this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
} }
@ -259,7 +262,7 @@ class PaginatorHelperTest extends CakeTestCase {
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/', 'passedArgs' => array()) array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/', 'passedArgs' => array())
)); ));
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
$result = $this->Paginator->sort('Title','Article.title'); $result = $this->Paginator->sort('Title','Article.title');
$expected = array( $expected = array(
'a' => array('href' => '/officespace/accounts/index/page:1/sort:Article.title/direction:asc', 'class' => 'desc'), 'a' => array('href' => '/officespace/accounts/index/page:1/sort:Article.title/direction:asc', 'class' => 'desc'),
@ -268,7 +271,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$result = $this->Paginator->sort('Title','Article.title'); $result = $this->Paginator->sort('Title','Article.title');
$expected = array( $expected = array(
'a' => array('href' => '/officespace/accounts/index/page:1/sort:Article.title/direction:desc', 'class' => 'asc'), 'a' => array('href' => '/officespace/accounts/index/page:1/sort:Article.title/direction:desc', 'class' => 'asc'),
@ -277,7 +280,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Account.title' => 'asc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('Account.title' => 'asc');
$result = $this->Paginator->sort('title'); $result = $this->Paginator->sort('title');
$expected = array( $expected = array(
'a' => array('href' => '/officespace/accounts/index/page:1/sort:title/direction:asc'), 'a' => array('href' => '/officespace/accounts/index/page:1/sort:title/direction:asc'),
@ -318,48 +321,48 @@ class PaginatorHelperTest extends CakeTestCase {
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
$result = $this->Paginator->sortDir(); $result = $this->Paginator->sortDir();
$expected = 'desc'; $expected = 'desc';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
unset($this->Paginator->params['paging']['Article']['options']); unset($this->Paginator->request->params['paging']['Article']['options']);
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$result = $this->Paginator->sortDir(); $result = $this->Paginator->sortDir();
$expected = 'asc'; $expected = 'asc';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
unset($this->Paginator->params['paging']['Article']['options']); unset($this->Paginator->request->params['paging']['Article']['options']);
$this->Paginator->params['paging']['Article']['options']['order'] = array('title' => 'desc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('title' => 'desc');
$result = $this->Paginator->sortDir(); $result = $this->Paginator->sortDir();
$expected = 'desc'; $expected = 'desc';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
unset($this->Paginator->params['paging']['Article']['options']); unset($this->Paginator->request->params['paging']['Article']['options']);
$this->Paginator->params['paging']['Article']['options']['order'] = array('title' => 'asc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('title' => 'asc');
$result = $this->Paginator->sortDir(); $result = $this->Paginator->sortDir();
$expected = 'asc'; $expected = 'asc';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
unset($this->Paginator->params['paging']['Article']['options']); unset($this->Paginator->request->params['paging']['Article']['options']);
$this->Paginator->params['paging']['Article']['options']['direction'] = 'asc'; $this->Paginator->request->params['paging']['Article']['options']['direction'] = 'asc';
$result = $this->Paginator->sortDir(); $result = $this->Paginator->sortDir();
$expected = 'asc'; $expected = 'asc';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
unset($this->Paginator->params['paging']['Article']['options']); unset($this->Paginator->request->params['paging']['Article']['options']);
$this->Paginator->params['paging']['Article']['options']['direction'] = 'desc'; $this->Paginator->request->params['paging']['Article']['options']['direction'] = 'desc';
$result = $this->Paginator->sortDir(); $result = $this->Paginator->sortDir();
$expected = 'desc'; $expected = 'desc';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
unset($this->Paginator->params['paging']['Article']['options']); unset($this->Paginator->request->params['paging']['Article']['options']);
$result = $this->Paginator->sortDir('Article', array('direction' => 'asc')); $result = $this->Paginator->sortDir('Article', array('direction' => 'asc'));
$expected = 'asc'; $expected = 'asc';
@ -391,7 +394,7 @@ class PaginatorHelperTest extends CakeTestCase {
array('base' => '', 'here' => '/admin/users', 'webroot' => '/') array('base' => '', 'here' => '/admin/users', 'webroot' => '/')
)); ));
Router::parse('/admin/users'); Router::parse('/admin/users');
$this->Paginator->params['paging']['Article']['page'] = 1; $this->Paginator->request->params['paging']['Article']['page'] = 1;
$result = $this->Paginator->next('Next'); $result = $this->Paginator->next('Next');
$expected = array( $expected = array(
'<span', '<span',
@ -445,7 +448,7 @@ class PaginatorHelperTest extends CakeTestCase {
$result = $this->Paginator->url(); $result = $this->Paginator->url();
$this->assertEqual($result, '/index/page:1'); $this->assertEqual($result, '/index/page:1');
$this->Paginator->params['paging']['Article']['options']['page'] = 2; $this->Paginator->request->params['paging']['Article']['options']['page'] = 2;
$result = $this->Paginator->url(); $result = $this->Paginator->url();
$this->assertEqual($result, '/index/page:2'); $this->assertEqual($result, '/index/page:2');
@ -453,7 +456,7 @@ class PaginatorHelperTest extends CakeTestCase {
$result = $this->Paginator->url($options); $result = $this->Paginator->url($options);
$this->assertEqual($result, '/index/page:2/sort:Article/direction:desc'); $this->assertEqual($result, '/index/page:2/sort:Article/direction:desc');
$this->Paginator->params['paging']['Article']['options']['page'] = 3; $this->Paginator->request->params['paging']['Article']['options']['page'] = 3;
$options = array('order' => array('Article.name' => 'desc')); $options = array('order' => array('Article.name' => 'desc'));
$result = $this->Paginator->url($options); $result = $this->Paginator->url($options);
$this->assertEqual($result, '/index/page:3/sort:Article.name/direction:desc'); $this->assertEqual($result, '/index/page:3/sort:Article.name/direction:desc');
@ -478,9 +481,9 @@ class PaginatorHelperTest extends CakeTestCase {
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => 'posts/index', 'webroot' => '/') array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => 'posts/index', 'webroot' => '/')
)); ));
$this->Paginator->params['paging']['Article']['options']['page'] = 2; $this->Paginator->request->params['paging']['Article']['options']['page'] = 2;
$this->Paginator->params['paging']['Article']['page'] = 2; $this->Paginator->request->params['paging']['Article']['page'] = 2;
$this->Paginator->params['paging']['Article']['prevPage'] = true; $this->Paginator->request->params['paging']['Article']['prevPage'] = true;
$options = array('members' => true); $options = array('members' => true);
$result = $this->Paginator->url($options); $result = $this->Paginator->url($options);
@ -539,7 +542,7 @@ class PaginatorHelperTest extends CakeTestCase {
$this->assertEqual('myDiv', $this->Paginator->options['update']); $this->assertEqual('myDiv', $this->Paginator->options['update']);
$this->Paginator->options = array(); $this->Paginator->options = array();
$this->Paginator->params = array(); $this->Paginator->request->params = array();
$options = array('paging' => array('Article' => array( $options = array('paging' => array('Article' => array(
'order' => 'desc', 'order' => 'desc',
@ -551,17 +554,17 @@ class PaginatorHelperTest extends CakeTestCase {
'order' => 'desc', 'order' => 'desc',
'sort' => 'title' 'sort' => 'title'
)); ));
$this->assertEqual($expected, $this->Paginator->params['paging']); $this->assertEqual($expected, $this->Paginator->request->params['paging']);
$this->Paginator->options = array(); $this->Paginator->options = array();
$this->Paginator->params = array(); $this->Paginator->request->params = array();
$options = array('Article' => array( $options = array('Article' => array(
'order' => 'desc', 'order' => 'desc',
'sort' => 'title' 'sort' => 'title'
)); ));
$this->Paginator->options($options); $this->Paginator->options($options);
$this->assertEqual($expected, $this->Paginator->params['paging']); $this->assertEqual($expected, $this->Paginator->request->params['paging']);
$options = array('paging' => array('Article' => array( $options = array('paging' => array('Article' => array(
'order' => 'desc', 'order' => 'desc',
@ -573,7 +576,7 @@ class PaginatorHelperTest extends CakeTestCase {
'order' => 'desc', 'order' => 'desc',
'sort' => 'Article.title' 'sort' => 'Article.title'
)); ));
$this->assertEqual($expected, $this->Paginator->params['paging']); $this->assertEqual($expected, $this->Paginator->request->params['paging']);
} }
/** /**
@ -589,7 +592,7 @@ class PaginatorHelperTest extends CakeTestCase {
array('plugin' => null, 'controller' => 'articles', 'action' => 'index', 'pass' => array('2'), 'named' => array('foo' => 'bar'), 'form' => array(), 'url' => array('url' => 'articles/index/2/foo:bar'), 'bare' => 0), array('plugin' => null, 'controller' => 'articles', 'action' => 'index', 'pass' => array('2'), 'named' => array('foo' => 'bar'), 'form' => array(), 'url' => array('url' => 'articles/index/2/foo:bar'), 'bare' => 0),
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '/', 'here' => '/articles/', 'webroot' => '/', 'passedArgs' => array(0 => '2', 'foo' => 'bar')) array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '/', 'here' => '/articles/', 'webroot' => '/', 'passedArgs' => array(0 => '2', 'foo' => 'bar'))
)); ));
$this->Paginator->params['paging'] = array( $this->Paginator->request->params['paging'] = array(
'Article' => array( 'Article' => array(
'page' => 1, 'current' => 3, 'count' => 13, 'page' => 1, 'current' => 3, 'count' => 13,
'prevPage' => false, 'nextPage' => true, 'pageCount' => 8, 'prevPage' => false, 'nextPage' => true, 'pageCount' => 8,
@ -602,8 +605,8 @@ class PaginatorHelperTest extends CakeTestCase {
) )
); );
$this->Paginator->params['pass'] = array(2); $this->Paginator->request->params['pass'] = array(2);
$this->Paginator->params['named'] = array('foo' => 'bar'); $this->Paginator->request->params['named'] = array('foo' => 'bar');
$this->Paginator->beforeRender(); $this->Paginator->beforeRender();
$result = $this->Paginator->sort('title'); $result = $this->Paginator->sort('title');
@ -650,7 +653,7 @@ class PaginatorHelperTest extends CakeTestCase {
* @return void * @return void
*/ */
function testPagingLinks() { function testPagingLinks() {
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 1, 'current' => 3, 'count' => 13, 'prevPage' => false, 'nextPage' => true, 'pageCount' => 5, 'page' => 1, 'current' => 3, 'count' => 13, 'prevPage' => false, 'nextPage' => true, 'pageCount' => 5,
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()), 'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -671,8 +674,8 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging']['Client']['page'] = 2; $this->Paginator->request->params['paging']['Client']['page'] = 2;
$this->Paginator->params['paging']['Client']['prevPage'] = true; $this->Paginator->request->params['paging']['Client']['prevPage'] = true;
$result = $this->Paginator->prev('<< Previous', null, null, array('class' => 'disabled')); $result = $this->Paginator->prev('<< Previous', null, null, array('class' => 'disabled'));
$expected = array( $expected = array(
'<span', '<span',
@ -723,7 +726,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 1, 'current' => 1, 'count' => 13, 'prevPage' => false, 'nextPage' => true, 'pageCount' => 5, 'page' => 1, 'current' => 1, 'count' => 13, 'prevPage' => false, 'nextPage' => true, 'pageCount' => 5,
'defaults' => array(), 'defaults' => array(),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -753,14 +756,14 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 1, 'current' => 3, 'count' => 13, 'prevPage' => false, 'nextPage' => true, 'pageCount' => 5, 'page' => 1, 'current' => 3, 'count' => 13, 'prevPage' => false, 'nextPage' => true, 'pageCount' => 5,
'defaults' => array(), 'defaults' => array(),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
); );
$this->Paginator->params['paging']['Client']['page'] = 2; $this->Paginator->request->params['paging']['Client']['page'] = 2;
$this->Paginator->params['paging']['Client']['prevPage'] = true; $this->Paginator->request->params['paging']['Client']['prevPage'] = true;
$result = $this->Paginator->prev('<< Previous', null, null, array('class' => 'disabled')); $result = $this->Paginator->prev('<< Previous', null, null, array('class' => 'disabled'));
$expected = array( $expected = array(
'<span', '<span',
@ -781,7 +784,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 2, 'current' => 1, 'count' => 13, 'prevPage' => true, 'nextPage' => false, 'pageCount' => 2, 'page' => 2, 'current' => 1, 'count' => 13, 'prevPage' => true, 'nextPage' => false, 'pageCount' => 2,
'defaults' => array(), 'defaults' => array(),
'options' => array('page' => 2, 'limit' => 10, 'order' => array(), 'conditions' => array()) 'options' => array('page' => 2, 'limit' => 10, 'order' => array(), 'conditions' => array())
@ -796,7 +799,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array( $this->Paginator->request->params['paging'] = array(
'Client' => array( 'Client' => array(
'page' => 2, 'current' => 1, 'count' => 13, 'prevPage' => true, 'page' => 2, 'current' => 1, 'count' => 13, 'prevPage' => true,
'nextPage' => false, 'pageCount' => 2, 'nextPage' => false, 'pageCount' => 2,
@ -825,7 +828,7 @@ class PaginatorHelperTest extends CakeTestCase {
* @return void * @return void
*/ */
function testPagingLinksOptionsReplaceEmptyDisabledOptions() { function testPagingLinksOptionsReplaceEmptyDisabledOptions() {
$this->Paginator->params['paging'] = array( $this->Paginator->request->params['paging'] = array(
'Client' => array( 'Client' => array(
'page' => 1, 'current' => 3, 'count' => 13, 'prevPage' => false, 'page' => 1, 'current' => 3, 'count' => 13, 'prevPage' => false,
'nextPage' => true, 'pageCount' => 5, 'nextPage' => true, 'pageCount' => 5,
@ -866,7 +869,7 @@ class PaginatorHelperTest extends CakeTestCase {
*/ */
function testPagingLinksNotDefaultModel() { function testPagingLinksNotDefaultModel() {
// Multiple Model Paginate // Multiple Model Paginate
$this->Paginator->params['paging'] = array( $this->Paginator->request->params['paging'] = array(
'Client' => array( 'Client' => array(
'page' => 1, 'current' => 3, 'count' => 13, 'prevPage' => false, 'nextPage' => true, 'pageCount' => 5, 'page' => 1, 'current' => 3, 'count' => 13, 'prevPage' => false, 'nextPage' => true, 'pageCount' => 5,
'defaults' => array( 'limit'=>3, 'order' => array('Client.name' => 'DESC')), 'defaults' => array( 'limit'=>3, 'order' => array('Client.name' => 'DESC')),
@ -910,7 +913,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging']['Article']['options']['page'] = 2; $this->Paginator->request->params['paging']['Article']['options']['page'] = 2;
$result = $this->Paginator->link('Sort by title', array('sort' => 'title', 'direction' => 'desc')); $result = $this->Paginator->link('Sort by title', array('sort' => 'title', 'direction' => 'desc'));
$expected = array( $expected = array(
'a' => array('href' => '/index/page:2/sort:title/direction:desc'), 'a' => array('href' => '/index/page:2/sort:title/direction:desc'),
@ -919,7 +922,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging']['Article']['options']['page'] = 4; $this->Paginator->request->params['paging']['Article']['options']['page'] = 4;
$result = $this->Paginator->link('Sort by title on page 4', array('sort' => 'Article.title', 'direction' => 'desc')); $result = $this->Paginator->link('Sort by title on page 4', array('sort' => 'Article.title', 'direction' => 'desc'));
$expected = array( $expected = array(
'a' => array('href' => '/index/page:4/sort:Article.title/direction:desc'), 'a' => array('href' => '/index/page:4/sort:Article.title/direction:desc'),
@ -974,7 +977,7 @@ class PaginatorHelperTest extends CakeTestCase {
* @return void * @return void
*/ */
function testNumbers() { function testNumbers() {
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 8, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15, 'page' => 8, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()), 'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1063,7 +1066,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 1, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15, 'page' => 1, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()), 'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1091,7 +1094,7 @@ class PaginatorHelperTest extends CakeTestCase {
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 14, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15, 'page' => 14, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()), 'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1118,7 +1121,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 2, 'current' => 3, 'count' => 27, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 9, 'page' => 2, 'current' => 3, 'count' => 27, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 9,
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()), 'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1168,7 +1171,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 15, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15, 'page' => 15, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()), 'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1199,7 +1202,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 10, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15, 'page' => 10, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()), 'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1231,7 +1234,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 6, 'current' => 15, 'count' => 623, 'prevPage' => 1, 'nextPage' => 1, 'pageCount' => 42, 'page' => 6, 'current' => 15, 'count' => 623, 'prevPage' => 1, 'nextPage' => 1, 'pageCount' => 42,
'defaults' => array('limit' => 15, 'step' => 1, 'page' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()), 'defaults' => array('limit' => 15, 'step' => 1, 'page' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 6, 'limit' => 15, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 6, 'limit' => 15, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1263,7 +1266,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 37, 'current' => 15, 'count' => 623, 'prevPage' => 1, 'nextPage' => 1, 'pageCount' => 42, 'page' => 37, 'current' => 15, 'count' => 623, 'prevPage' => 1, 'nextPage' => 1, 'pageCount' => 42,
'defaults' => array('limit' => 15, 'step' => 1, 'page' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()), 'defaults' => array('limit' => 15, 'step' => 1, 'page' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 37, 'limit' => 15, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 37, 'limit' => 15, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1295,7 +1298,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array( $this->Paginator->request->params['paging'] = array(
'Client' => array( 'Client' => array(
'page' => 1, 'page' => 1,
'current' => 10, 'current' => 10,
@ -1328,7 +1331,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 2, 'current' => 10, 'count' => 31, 'prevPage' => true, 'nextPage' => true, 'pageCount' => 4, 'page' => 2, 'current' => 10, 'count' => 31, 'prevPage' => true, 'nextPage' => true, 'pageCount' => 4,
'defaults' => array('limit' => 10), 'defaults' => array('limit' => 10),
'options' => array('page' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1346,7 +1349,7 @@ class PaginatorHelperTest extends CakeTestCase {
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 4895, 'current' => 10, 'count' => 48962, 'prevPage' => 1, 'nextPage' => 1, 'pageCount' => 4897, 'page' => 4895, 'current' => 10, 'count' => 48962, 'prevPage' => 1, 'nextPage' => 1, 'pageCount' => 4897,
'defaults' => array('limit' => 10), 'defaults' => array('limit' => 10),
'options' => array('page' => 4894, 'limit' => 10, 'order' => 'Client.name DESC', 'conditions' => array())) 'options' => array('page' => 4894, 'limit' => 10, 'order' => 'Client.name DESC', 'conditions' => array()))
@ -1368,7 +1371,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging']['Client']['page'] = 3; $this->Paginator->request->params['paging']['Client']['page'] = 3;
$result = $this->Paginator->numbers(array('first' => 2, 'modulus' => 2, 'last' => 2)); $result = $this->Paginator->numbers(array('first' => 2, 'modulus' => 2, 'last' => 2));
$expected = array( $expected = array(
@ -1428,7 +1431,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging']['Client']['page'] = 4893; $this->Paginator->request->params['paging']['Client']['page'] = 4893;
$result = $this->Paginator->numbers(array('first' => 5, 'modulus' => 4, 'last' => 5, 'separator' => ' - ')); $result = $this->Paginator->numbers(array('first' => 5, 'modulus' => 4, 'last' => 5, 'separator' => ' - '));
$expected = array( $expected = array(
array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span', array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
@ -1457,7 +1460,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging']['Client']['page'] = 58; $this->Paginator->request->params['paging']['Client']['page'] = 58;
$result = $this->Paginator->numbers(array('first' => 5, 'modulus' => 4, 'last' => 5, 'separator' => ' - ')); $result = $this->Paginator->numbers(array('first' => 5, 'modulus' => 4, 'last' => 5, 'separator' => ' - '));
$expected = array( $expected = array(
array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span', array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
@ -1492,7 +1495,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging']['Client']['page'] = 5; $this->Paginator->request->params['paging']['Client']['page'] = 5;
$result = $this->Paginator->numbers(array('first' => 5, 'modulus' => 4, 'last' => 5, 'separator' => ' - ')); $result = $this->Paginator->numbers(array('first' => 5, 'modulus' => 4, 'last' => 5, 'separator' => ' - '));
$expected = array( $expected = array(
array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span', array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
@ -1529,7 +1532,7 @@ class PaginatorHelperTest extends CakeTestCase {
* @return void * @return void
*/ */
function testFirstAndLast() { function testFirstAndLast() {
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 1, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15, 'page' => 1, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()), 'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1539,7 +1542,7 @@ class PaginatorHelperTest extends CakeTestCase {
$expected = ''; $expected = '';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 4, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15, 'page' => 4, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()), 'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1612,7 +1615,7 @@ class PaginatorHelperTest extends CakeTestCase {
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 15, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15, 'page' => 15, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()), 'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1621,7 +1624,7 @@ class PaginatorHelperTest extends CakeTestCase {
$expected = ''; $expected = '';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$this->Paginator->params['paging'] = array('Client' => array( $this->Paginator->request->params['paging'] = array('Client' => array(
'page' => 4, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15, 'page' => 4, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
'defaults' => array('limit' => 3), 'defaults' => array('limit' => 3),
'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array())) 'options' => array('page' => 1, 'limit' => 3, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()))
@ -1673,7 +1676,7 @@ class PaginatorHelperTest extends CakeTestCase {
* @return void * @return void
*/ */
function testCounter() { function testCounter() {
$this->Paginator->params['paging'] = array( $this->Paginator->request->params['paging'] = array(
'Client' => array( 'Client' => array(
'page' => 1, 'page' => 1,
'current' => 3, 'current' => 3,
@ -1810,8 +1813,8 @@ class PaginatorHelperTest extends CakeTestCase {
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/', 'passedArgs' => array()) array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/', 'passedArgs' => array())
)); ));
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc'); $this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$this->Paginator->params['paging']['Article']['page'] = 1; $this->Paginator->request->params['paging']['Article']['page'] = 1;
$test = array('url'=> array( $test = array('url'=> array(
'page'=> '1', 'page'=> '1',
@ -1864,7 +1867,7 @@ class PaginatorHelperTest extends CakeTestCase {
*/ */
function testMockAjaxProviderClassInjection() { function testMockAjaxProviderClassInjection() {
$Paginator = new PaginatorHelper(array('ajax' => 'PaginatorMockJs')); $Paginator = new PaginatorHelper(array('ajax' => 'PaginatorMockJs'));
$Paginator->params['paging'] = array( $Paginator->request->params['paging'] = array(
'Article' => array( 'Article' => array(
'current' => 9, 'current' => 9,
'count' => 62, 'count' => 62,