Sort lists that check ordering of results

These tests would randomly fail, mostly on Postgres, as the result
is an unordered set, not the ordered set expected.
This commit is contained in:
Simon Welsh 2012-12-07 08:45:52 +13:00
parent 5ca000d0a5
commit aadefbb641

View File

@ -378,6 +378,7 @@ class DataListTest extends SapphireTest {
public function testSimpleFilterWithMultiple() {
$list = DataObjectTest_TeamComment::get();
$list = $list->filter('Name', array('Bob','Phil'));
$list = $list->sort('Name', 'ASC');
$this->assertEquals(2, $list->count());
$this->assertEquals('Bob', $list->first()->Name, 'First comment should be from Bob');
$this->assertEquals('Phil', $list->last()->Name, 'Last comment should be from Phil');
@ -395,6 +396,7 @@ class DataListTest extends SapphireTest {
public function testFilterMultipleArray() {
$list = DataObjectTest_TeamComment::get();
$list = $list->filter(array('Name'=>'Bob', 'Comment'=>'This is a team comment by Bob'));
$list = $list->sort('Name', 'ASC');
$this->assertEquals(1, $list->count());
$this->assertEquals('Bob', $list->first()->Name, 'Only comment should be from Bob');
}
@ -408,6 +410,7 @@ class DataListTest extends SapphireTest {
public function testFilterMultipleWithArrayFilter() {
$list = DataObjectTest_TeamComment::get();
$list = $list->filter(array('Name'=>array('Bob','Phil')));
$list = $list->sort('Name', 'ASC');
$this->assertEquals(2, $list->count(), 'There should be two comments');
$this->assertEquals('Bob', $list->first()->Name, 'First comment should be from Bob');
$this->assertEquals('Phil', $list->last()->Name, 'Last comment should be from Phil');