mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
5ca000d0a5
commit
aadefbb641
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user