Reviewers: shindig-dev, chabotc, panjie,
Description:
The existing failures are caused by the diff between UNIX and WINDOWS
file formats: there's "\n" in UNIX one while "\r\n" in WINDOWS one.
We actually want to compare the json/xml objects, rather than their
string representation.
Please review this at http://codereview.appspot.com/27067
Affected files:
php/test/social/OutputAtomConverterTest.php
php/test/social/OutputJsonConverterTest.php
php/test/social/OutputXmlConverterTest.php
Index: php/test/social/OutputAtomConverterTest.php
===================================================================
--- php/test/social/OutputAtomConverterTest.php (revision 755476)
+++ php/test/social/OutputAtomConverterTest.php (working copy)
@@ -22,7 +22,7 @@
* OutputAtomConverter test case.
*/
class OutputAtomConverterTest extends PHPUnit_Framework_TestCase {
-
+
/**
* @var OutputAtomConverter
*/
@@ -55,7 +55,7 @@
$requestItem = RestRequestItem::createWithRequest($servletRequest,
$token, $inputConverter, $outputConverter);
$requestItem->applyUrlTemplate("/people/{userId}/{groupId}/{personId}");
$entry = array('isOwner' => false, 'isViewer' => false,
- 'displayName' => '1 1', 'id' => '1');
+ 'displayName' => '1 1 1', 'id' => '1');
$response = new DataCollection($entry);
$responseItem = new ResponseItem(null, null, $response);
ob_start();
@@ -73,7 +73,7 @@
<person xmlns="http://ns.opensocial.org/2008/opensocial">
<isOwner></isOwner>
<isViewer></isViewer>
- <displayName>1 1</displayName>
+ <displayName>1 1 1</displayName>
<id>1</id>
</person>
</content>
Index: php/test/social/OutputJsonConverterTest.php
===================================================================
--- php/test/social/OutputJsonConverterTest.php (revision 755476)
+++ php/test/social/OutputJsonConverterTest.php (working copy)
@@ -55,7 +55,7 @@
$requestItem = RestRequestItem::createWithRequest($servletRequest,
$token, $inputConverter, $outputConverter);
$requestItem->applyUrlTemplate("/people/{userId}/{groupId}/{personId}");
$response = array(
- 'entry' => array('isOwner' => false, 'isViewer' =>
false, 'displayName' => '1 1',
+ 'entry' => array('isOwner' => false, 'isViewer' =>
false, 'displayName' => '1 1 1',
'id' => '1'));
$responseItem = new ResponseItem(null, null, $response);
ob_start();
@@ -65,11 +65,13 @@
"entry": {
"isOwner": false,
"isViewer": false,
- "displayName": "1 1",
+ "displayName": "1 1 1",
"id": "1"
}
}';
- $this->assertEquals($expected, $output);
+ $outputJson = json_decode($output);
+ $expectedJson = json_decode($expected);
+ $this->assertEquals($expectedJson, $outputJson);
}
}
Index: php/test/social/OutputXmlConverterTest.php
===================================================================
--- php/test/social/OutputXmlConverterTest.php (revision 755476)
+++ php/test/social/OutputXmlConverterTest.php (working copy)
@@ -22,7 +22,7 @@
* OutputXmlConverter test case.
*/
class OutputXmlConverterTest extends PHPUnit_Framework_TestCase {
-
+
/**
* @var OutputXmlConverter
*/
@@ -55,7 +55,7 @@
$requestItem = RestRequestItem::createWithRequest($servletRequest,
$token, $inputConverter, $outputConverter);
$requestItem->applyUrlTemplate("/people/{userId}/{groupId}/{personId}");
$entry = array('isOwner' => false, 'isViewer' => false,
- 'displayName' => '1 1', 'id' => '1');
+ 'displayName' => '1 1 1', 'id' => '1');
$response = new DataCollection($entry);
$responseItem = new ResponseItem(null, null, $response);
ob_start();
@@ -66,12 +66,14 @@
<entry>
<isOwner></isOwner>
<isViewer></isViewer>
- <displayName>1 1</displayName>
+ <displayName>1 1 1</displayName>
<id>1</id>
</entry>
</response>
';
- $this->assertEquals($expected, $output);
+ $outputXml = simplexml_load_string($output);
+ $expectedXml = simplexml_load_string($expected);
+ $this->assertEquals($expectedXml, $outputXml);
}
}