Permalink
Browse files

MINOR Fixed fixture ordering in RestfulServerTest to work with Postgr…

…eSQL
  • Loading branch information...
1 parent cbf191b commit a2d334ca0c4fa418460593ea1e54c4b0f5c1a292 @chillu chillu committed May 18, 2011
Showing with 9 additions and 4 deletions.
  1. +9 −4 tests/api/RestfulServerTest.php
@@ -360,17 +360,22 @@ public function testApiAccessWithPUT() {
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");
}

0 comments on commit a2d334c

Please sign in to comment.