BUGFIX Fixed SearchFilterApplyRelationTest not to assume ID ordering in the assertions, which breaks with databases not ordering by PK automatically (e.g. Postgres)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@87926 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-10-01 22:20:04 +00:00
parent 8a4f2f2bf0
commit 277bffb664

View File

@ -28,6 +28,9 @@ class SearchFilterApplyRelationTest extends SapphireTest{
} }
function testApplyRelationHasMany(){ function testApplyRelationHasMany(){
$do1 = $this->objFromFixture('SearchFilterApplyRelationTest_DO', 'do1');
$do2 = $this->objFromFixture('SearchFilterApplyRelationTest_DO', 'do2');
$all = singleton("SearchFilterApplyRelationTest_DO"); $all = singleton("SearchFilterApplyRelationTest_DO");
$context = $all->getDefaultSearchContext(); $context = $all->getDefaultSearchContext();
@ -39,14 +42,14 @@ class SearchFilterApplyRelationTest extends SapphireTest{
); );
$results = $context->getResults($params); $results = $context->getResults($params);
$this->assertEquals(1, $results->count()); $this->assertEquals(1, $results->count());
$this->assertEquals(array('1'), $results->column('ID')); $this->assertEquals(array($do1->ID), $results->column('ID'));
$params = array( $params = array(
"SearchFilterApplyRelationTest_HasManyGrantChildren__Title" => "I am has_many object3", "SearchFilterApplyRelationTest_HasManyGrantChildren__Title" => "I am has_many object3",
); );
$results = $context->getResults($params); $results = $context->getResults($params);
$this->assertEquals(1, $results->count()); $this->assertEquals(1, $results->count());
$this->assertEquals(array('2'), $results->column('ID')); $this->assertEquals(array($do2->ID), $results->column('ID'));
$params = array( $params = array(
"SearchFilterApplyRelationTest_HasManyGrantChildren__Title" => "I am has_many object", "SearchFilterApplyRelationTest_HasManyGrantChildren__Title" => "I am has_many object",