Skip to content

Commit

Permalink
Add some fixed orders.
Browse files Browse the repository at this point in the history
Hopefully this makes tests in postgres more reliable.
  • Loading branch information
markstory committed Oct 25, 2012
1 parent 5786245 commit 9e07789
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 12 additions & 3 deletions lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
Expand Up @@ -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';
Expand Down Expand Up @@ -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'));
Expand Down
8 changes: 6 additions & 2 deletions lib/Cake/Test/Case/Model/ModelReadTest.php
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 9e07789

Please sign in to comment.