Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add some fixed orders.

Hopefully this makes tests in postgres more reliable.
  • Loading branch information...
commit 9e0778951a45efebed0e2d3ef9eb79273fa7a799 1 parent 5786245
Mark Story markstory authored
15 lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
View
@@ -353,12 +353,18 @@ public function testPaginate() {
$Controller->request->query = array();
$Controller->constructClasses();
- $results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
- $this->assertEquals(array(1, 2, 3), $results);
-
+ $Controller->Paginator->settings = array(
+ 'order' => array('PaginatorControllerComment.id' => 'ASC')
+ );
$results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerComment'), '{n}.PaginatorControllerComment.id');
$this->assertEquals(array(1, 2, 3, 4, 5, 6), $results);
+ $Controller->Paginator->settings = array(
+ 'order' => array('PaginatorControllerPost.id' => 'ASC')
+ );
+ $results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
+ $this->assertEquals(array(1, 2, 3), $results);
+
$Controller->modelClass = null;
$Controller->uses[0] = 'Plugin.PaginatorControllerPost';
@@ -473,6 +479,9 @@ public function testPaginateExtraParams() {
$Controller->constructClasses();
$Controller->request->params['named'] = array('page' => '-1', 'contain' => array('PaginatorControllerComment'));
+ $Controller->Paginator->settings = array(
+ 'order' => array('PaginatorControllerPost.id' => 'ASC')
+ );
$result = $Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']);
$this->assertEquals(array(1, 2, 3), Hash::extract($result, '{n}.PaginatorControllerPost.id'));
8 lib/Cake/Test/Case/Model/ModelReadTest.php
View
@@ -4959,7 +4959,9 @@ public function testUnBindMultipleTimesWithDifferentResetSettings() {
public function testAssociationAfterFind() {
$this->loadFixtures('Post', 'Author', 'Comment');
$TestModel = new Post();
- $result = $TestModel->find('all');
+ $result = $TestModel->find('all', array(
+ 'order' => array('Post.id' => 'ASC')
+ ));
$expected = array(
array(
'Post' => array(
@@ -5384,7 +5386,9 @@ public function testNonNumericHabtmJoinKey() {
));
$Post->Tag->primaryKey = 'tag';
- $result = $Post->find('all');
+ $result = $Post->find('all', array(
+ 'order' => array('Post.id' => 'ASC')
+ ));
$expected = array(
array(
'Post' => array(
Please sign in to comment.
Something went wrong with that request. Please try again.