Add some fixed orders.

Hopefully this makes tests in postgres more reliable.
This commit is contained in:
mark_story 2012-10-24 21:25:44 -04:00
parent 5786245832
commit 9e0778951a
2 changed files with 18 additions and 5 deletions

View file

@ -353,12 +353,18 @@ class PaginatorComponentTest extends CakeTestCase {
$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 @@ class PaginatorComponentTest extends CakeTestCase {
$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'));

View file

@ -4959,7 +4959,9 @@ class ModelReadTest extends BaseModelTest {
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 @@ class ModelReadTest extends BaseModelTest {
));
$Post->Tag->primaryKey = 'tag';
$result = $Post->find('all');
$result = $Post->find('all', array(
'order' => array('Post.id' => 'ASC')
));
$expected = array(
array(
'Post' => array(