From a2d334ca0c4fa418460593ea1e54c4b0f5c1a292 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 19 May 2011 10:25:40 +1200 Subject: [PATCH] MINOR Fixed fixture ordering in RestfulServerTest to work with PostgreSQL --- tests/api/RestfulServerTest.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/api/RestfulServerTest.php b/tests/api/RestfulServerTest.php index 0b0d10e63..d5c9e1395 100644 --- a/tests/api/RestfulServerTest.php +++ b/tests/api/RestfulServerTest.php @@ -360,17 +360,22 @@ class RestfulServerTest extends SapphireTest { public function testJSONDataFormatter() { $formatter = new JSONDataFormatter(); - $single_do = $this->objFromFixture('Member', 'editor'); + $editor = $this->objFromFixture('Member', 'editor'); + $user = $this->objFromFixture('Member', 'user'); $this->assertEquals( - $formatter->convertDataObject($single_do, array("FirstName", "Email")), + $formatter->convertDataObject($editor, array("FirstName", "Email")), '{"FirstName":"Editor","Email":"editor@test.com"}', "Correct JSON formatting with field subset"); - $set = DataObject::get("Member"); + $set = DataObject::get( + "Member", + sprintf('"Member"."ID" IN (%s)', implode(',', array($editor->ID, $user->ID))), + '"Email" ASC' // for sorting for postgres + ); $this->assertEquals( $formatter->convertDataObjectSet($set, array("FirstName", "Email")), - '{"totalSize":null,"items":[{"FirstName":"Editor","Email":"editor@test.com"},{"FirstName":"User","Email":"user@test.com"},{"FirstName":"ADMIN","Email":"ADMIN@example.org"}]}', + '{"totalSize":null,"items":[{"FirstName":"Editor","Email":"editor@test.com"},{"FirstName":"User","Email":"user@test.com"}]', "Correct JSON formatting on a dataobjectset with field filter"); }