Skip to content
This repository
Browse code

Add some fixed orders.

Hopefully this makes tests in postgres more reliable.
  • Loading branch information...
commit 9e0778951a45efebed0e2d3ef9eb79273fa7a799 1 parent 5786245
Mark Story authored October 24, 2012
15  lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
@@ -353,12 +353,18 @@ public function testPaginate() {
353 353
 		$Controller->request->query = array();
354 354
 		$Controller->constructClasses();
355 355
 
356  
-		$results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
357  
-		$this->assertEquals(array(1, 2, 3), $results);
358  
-
  356
+		$Controller->Paginator->settings = array(
  357
+			'order' => array('PaginatorControllerComment.id' => 'ASC')
  358
+		);
359 359
 		$results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerComment'), '{n}.PaginatorControllerComment.id');
360 360
 		$this->assertEquals(array(1, 2, 3, 4, 5, 6), $results);
361 361
 
  362
+		$Controller->Paginator->settings = array(
  363
+			'order' => array('PaginatorControllerPost.id' => 'ASC')
  364
+		);
  365
+		$results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
  366
+		$this->assertEquals(array(1, 2, 3), $results);
  367
+
362 368
 		$Controller->modelClass = null;
363 369
 
364 370
 		$Controller->uses[0] = 'Plugin.PaginatorControllerPost';
@@ -473,6 +479,9 @@ public function testPaginateExtraParams() {
473 479
 		$Controller->constructClasses();
474 480
 
475 481
 		$Controller->request->params['named'] = array('page' => '-1', 'contain' => array('PaginatorControllerComment'));
  482
+		$Controller->Paginator->settings = array(
  483
+			'order' => array('PaginatorControllerPost.id' => 'ASC')
  484
+		);
476 485
 		$result = $Controller->Paginator->paginate('PaginatorControllerPost');
477 486
 		$this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']);
478 487
 		$this->assertEquals(array(1, 2, 3), Hash::extract($result, '{n}.PaginatorControllerPost.id'));
8  lib/Cake/Test/Case/Model/ModelReadTest.php
@@ -4959,7 +4959,9 @@ public function testUnBindMultipleTimesWithDifferentResetSettings() {
4959 4959
 	public function testAssociationAfterFind() {
4960 4960
 		$this->loadFixtures('Post', 'Author', 'Comment');
4961 4961
 		$TestModel = new Post();
4962  
-		$result = $TestModel->find('all');
  4962
+		$result = $TestModel->find('all', array(
  4963
+			'order' => array('Post.id' => 'ASC')
  4964
+		));
4963 4965
 		$expected = array(
4964 4966
 			array(
4965 4967
 				'Post' => array(
@@ -5384,7 +5386,9 @@ public function testNonNumericHabtmJoinKey() {
5384 5386
 		));
5385 5387
 		$Post->Tag->primaryKey = 'tag';
5386 5388
 
5387  
-		$result = $Post->find('all');
  5389
+		$result = $Post->find('all', array(
  5390
+			'order' => array('Post.id' => 'ASC')
  5391
+		));
5388 5392
 		$expected = array(
5389 5393
 			array(
5390 5394
 				'Post' => array(

0 notes on commit 9e07789

Please sign in to comment.
Something went wrong with that request. Please try again.