Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

test json encode of non string params

  • Loading branch information...
commit 8e05373f82696796cf247ff31cacd3d47b0bf931 1 parent 9c51484
@daaku daaku authored
Showing with 31 additions and 0 deletions.
  1. +31 −0 tests/tests.php
View
31 tests/tests.php
@@ -1352,6 +1352,21 @@ public function testErrorCodeFromRestAPIThrowsException() {
$stub->api(array('method' => 'foo'));
}
+ public function testJsonEncodeOfNonStringParams() {
+ $foo = array(1, 2);
+ $params = array(
+ 'method' => 'get',
+ 'foo' => $foo,
+ );
+ $fb = new FBRecordMakeRequest(array(
+ 'appId' => self::APP_ID,
+ 'secret' => self::SECRET,
+ ));
+ $fb->api('/naitik', $params);
+ $requests = $fb->publicGetRequests();
+ $this->assertEquals(json_encode($foo), $requests[0]['params']['foo']);
+ }
+
protected function generateMD5HashOfRandomValue() {
return md5(uniqid(mt_rand(), true));
}
@@ -1415,6 +1430,22 @@ public function getRequestedURL() {
}
}
+class FBRecordMakeRequest extends TransientFacebook {
+ private $requests = array();
+
+ protected function makeRequest($url, $params, $ch=null) {
+ $this->requests[] = array(
+ 'url' => $url,
+ 'params' => $params,
+ );
+ return parent::makeRequest($url, $params, $ch);
+ }
+
+ public function publicGetRequests() {
+ return $this->requests;
+ }
+}
+
class FBPublic extends TransientFacebook {
public static function publicBase64UrlDecode($input) {
return self::base64UrlDecode($input);
Please sign in to comment.
Something went wrong with that request. Please try again.