Permalink
Browse files

fix failing test for postgres

  • Loading branch information...
1 parent 43bc7ce commit 467b0f1c45d04eeaeee55e04c24aa00fbb49e0be @ceeram ceeram committed Mar 13, 2012
Showing with 11 additions and 9 deletions.
  1. +11 −9 lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
@@ -279,7 +279,8 @@ public function _findTotals($state, $query, $results = array()) {
$query['fields'] = array('author_id');
$this->virtualFields['total_posts'] = "COUNT({$this->alias}.id)";
$query['fields'][] = 'total_posts';
- $query['group'] = array($this->alias . '.author_id');
+ $query['group'] = array('author_id');
+ $query['order'] = array('author_id' => 'ASC');
return $query;
}
$this->virtualFields = array();
@@ -304,7 +305,8 @@ public function _findTotalsOperation($state, $query, $results = array()) {
$query['fields'] = array('author_id', 'Author.user');
$this->virtualFields['total_posts'] = "COUNT({$this->alias}.id)";
$query['fields'][] = 'total_posts';
- $query['group'] = array('Author.user');
+ $query['group'] = array('author_id');
+ $query['order'] = array('author_id' => 'ASC');
return $query;
}
$this->virtualFields = array();
@@ -1107,7 +1109,7 @@ public function testPaginateCustomFindGroupBy() {
}
/**
- * test paginate() and custom find with returning otehr query on count operation,
+ * test paginate() and custom find with returning other query on count operation,
* to make sure the correct count is returned.
*
* @return void
@@ -1129,20 +1131,20 @@ public function testPaginateCustomFindCount() {
$expected = array(
array(
'PaginatorCustomPost' => array(
- 'author_id' => '3',
- 'total_posts' => '1'
+ 'author_id' => '1',
+ 'total_posts' => '2'
),
'Author' => array(
- 'user' => 'larry',
+ 'user' => 'mariano',
)
),
array(
'PaginatorCustomPost' => array(
- 'author_id' => '1',
- 'total_posts' => '2'
+ 'author_id' => '2',
+ 'total_posts' => '1'
),
'Author' => array(
- 'user' => 'mariano'
+ 'user' => 'nate'
)
)
);

0 comments on commit 467b0f1

Please sign in to comment.