Try to fix random test failures on postgres.

Sorting in postgres is undefined and no based on the primary key when
sorting is not supplied.
This commit is contained in:
mark_story 2013-03-29 22:31:49 -04:00
parent 84c0de7e2d
commit ceb46b5d2c

View file

@ -394,9 +394,9 @@ class PaginatorComponentTest extends CakeTestCase {
$this->assertEquals(array(3, 2, 1), $results);
$Controller->request->params['named'] = array('sort' => 'NotExisting.field', 'direction' => 'desc');
$results = Hash::extract($Controller->Paginator->paginate('PaginatorControllerPost'), '{n}.PaginatorControllerPost.id');
$this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page'], 'Invalid field in query %s');
$this->assertEquals(array(1, 2, 3), $results);
$Controller->Paginator->paginate('PaginatorControllerPost');
$this->assertEquals(1, $Controller->params['paging']['PaginatorControllerPost']['page']);
$this->assertEquals(array(), $Controller->PaginatorControllerPost->lastQueries[1]['order'][0], 'no order should be set.');
$Controller->request->params['named'] = array(
'sort' => 'PaginatorControllerPost.author_id', 'direction' => 'allYourBase'