Skip to content
Permalink
Browse files

Remove pointless tests and fix failing ones.

Remove tests that no longer do anything like those for the order key.
Fix failing tests that were caused by lack of limit, or mistakes made in
previous work.
  • Loading branch information...
markstory committed Sep 18, 2013
1 parent 106cc2a commit 6bdd1d5c4638068acd0cb855f78b667dc55ceb09
Showing with 13 additions and 17 deletions.
  1. +11 −15 Cake/Test/TestCase/View/Helper/PaginatorHelperTest.php
  2. +2 −2 Cake/View/Helper/PaginatorHelper.php
@@ -54,8 +54,9 @@ public function setUp() {
'prevPage' => false,
'nextPage' => true,
'pageCount' => 7,
'order' => null,
'limit' => 20,
'sort' => null,
'direction' => null,
'limit' => null,
)
)
));
@@ -228,7 +229,7 @@ public function testSortLinks() {
$this->assertTags($result, $expected);
$this->Paginator->request->params['paging']['Article']['sort'] = 'Article.title';
$this->Paginator->request->params['paging']['Article']['sort'] = 'asc';
$this->Paginator->request->params['paging']['Article']['direction'] = 'asc';
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'asc'));
$expected = array(
'a' => array('href' => '/accounts/index/param?sort=title&direction=desc', 'class' => 'asc'),
@@ -396,14 +397,6 @@ public function testSortLinksUsingDotNotation() {
* @return void
*/
public function testSortKey() {
$result = $this->Paginator->sortKey(null, array(
'order' => array('Article.title' => 'desc'
)));
$this->assertEquals('Article.title', $result);
$result = $this->Paginator->sortKey('Article', array('order' => 'Article.title'));
$this->assertEquals('Article.title', $result);
$result = $this->Paginator->sortKey('Article', array('sort' => 'Article.title'));
$this->assertEquals('Article.title', $result);
@@ -418,16 +411,15 @@ public function testSortKey() {
* @return void
*/
public function testSortKeyFallbackToParams() {
$this->Paginator->request->params['paging']['Article']['order'] = 'Article.body';
$this->Paginator->request->params['paging']['Article']['sort'] = 'Article.body';
$result = $this->Paginator->sortKey();
$this->assertEquals('Article.body', $result);
$result = $this->Paginator->sortKey('Article');
$this->assertEquals('Article.body', $result);
$this->Paginator->request->params['paging']['Article']['order'] = array(
'Article.body' => 'DESC'
);
$this->Paginator->request->params['paging']['Article']['sort'] = 'Article.body';
$this->Paginator->request->params['paging']['Article']['order'] = 'DESC';
$result = $this->Paginator->sortKey();
$this->assertEquals('Article.body', $result);
@@ -1906,6 +1898,7 @@ public function testNumbers() {
* @return void
*/
public function testFirstAndLastTag() {
$this->Paginator->request->params['paging']['Article']['page'] = 2;
$result = $this->Paginator->first('<<', array('tag' => 'li', 'class' => 'first'));
$expected = array(
'li' => array('class' => 'first'),
@@ -1963,6 +1956,8 @@ public function testFirstEmpty() {
* @return void
*/
public function testFirstFullBaseUrl() {
$this->Paginator->request->params['paging']['Article']['page'] = 3;
$this->Paginator->request->params['paging']['Article']['direction'] = 'DESC';
$this->Paginator->request->params['paging']['Article']['sort'] = 'Article.title';
$this->Paginator->request->params['paging']['Article']['direction'] = 'DESC';
@@ -1987,6 +1982,7 @@ public function testFirstFullBaseUrl() {
* @return void
*/
public function testFirstBoundaries() {
$this->Paginator->request->params['paging']['Article']['page'] = 3;
$result = $this->Paginator->first();
$expected = array(
'<span',
@@ -351,9 +351,9 @@ public function url($options = array(), $asArray = false, $model = null) {
$paging += ['page' => null, 'sort' => null, 'direction' => null, 'limit' => null];
$url = [
'page' => $paging['page'],
'sort' => $paging['sort'],
'direction' => $paging['sort'],
'limit' => $paging['limit'],
'sort' => $paging['sort'],
'direction' => $paging['direction'],
];
$url = array_merge(array_filter($url), $options);

0 comments on commit 6bdd1d5

Please sign in to comment.
You can’t perform that action at this time.