You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2013/01/06 20:12:46 UTC

[1/2] git commit: THRIFT-1822 PHP unit test does not work Patch: Roger Meier

THRIFT-1822 PHP unit test does not work
Patch: Roger Meier


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/87afaacb
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/87afaacb
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/87afaacb

Branch: refs/heads/master
Commit: 87afaacb957e39f2100271180329dd7d718516e8
Parents: 8ebe0d9
Author: Roger Meier <ro...@apache.org>
Authored: Sun Jan 6 20:10:42 2013 +0100
Committer: Roger Meier <ro...@apache.org>
Committed: Sun Jan 6 20:10:42 2013 +0100

----------------------------------------------------------------------
 .../Test/Thrift/Protocol/TestTJSONProtocol.php     |   17 ++++++++++----
 test/php/TestClient.php                            |   14 ++++++------
 2 files changed, 19 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/87afaacb/lib/php/test/Test/Thrift/Protocol/TestTJSONProtocol.php
----------------------------------------------------------------------
diff --git a/lib/php/test/Test/Thrift/Protocol/TestTJSONProtocol.php b/lib/php/test/Test/Thrift/Protocol/TestTJSONProtocol.php
old mode 100644
new mode 100755
index 06c6ab2..d5aa69c
--- a/lib/php/test/Test/Thrift/Protocol/TestTJSONProtocol.php
+++ b/lib/php/test/Test/Thrift/Protocol/TestTJSONProtocol.php
@@ -535,11 +535,18 @@ class TestTJSONProtocol_Fixtures
 
     self::$testArgsJSON['testI32'] = '{"1":{"i32":1073741824}}';
 
-    self::$testArgsJSON['testI64'] = '{"1":{"i64":1152921504606847000}}';
-
-    self::$testArgsJSON['testStruct'] = '{"1":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":1152921504606847000}}}}';
-
-    self::$testArgsJSON['testNest'] = '{"1":{"rec":{"1":{"i8":1},"2":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":1152921504606847000}}},"3":{"i32":32768}}}}';
+    if ( PHP_INT_SIZE == 8 )
+    {
+      self::$testArgsJSON['testI64'] = '{"1":{"i64":'.pow( 2, 60 ).'}}';
+      self::$testArgsJSON['testStruct'] = '{"1":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":'.pow( 2, 60 ).'}}}}';
+      self::$testArgsJSON['testNest'] = '{"1":{"rec":{"1":{"i8":1},"2":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":'.pow( 2, 60 ).'}}},"3":{"i32":32768}}}}';
+    }
+    else
+    {
+      self::$testArgsJSON['testI64'] = '{"1":{"i64":1152921504606847000}}';
+      self::$testArgsJSON['testStruct'] = '{"1":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":1152921504606847000}}}}';
+      self::$testArgsJSON['testNest'] = '{"1":{"rec":{"1":{"i8":1},"2":{"rec":{"1":{"str":"worked"},"4":{"i8":1},"9":{"i32":1073741824},"11":{"i64":1152921504606847000}}},"3":{"i32":32768}}}}';
+    }
 
     self::$testArgsJSON['testMap'] = '{"1":{"map":["i32","i32",3,{"7":77,"8":88,"9":99}]}}';
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/87afaacb/test/php/TestClient.php
----------------------------------------------------------------------
diff --git a/test/php/TestClient.php b/test/php/TestClient.php
index 4df498c..c334aee 100755
--- a/test/php/TestClient.php
+++ b/test/php/TestClient.php
@@ -257,23 +257,23 @@ print_r("}\n");
  * ENUM TEST
  */
 print_r("testEnum(ONE)");
-$ret = $testClient->testEnum(ThriftTest_Numberz::ONE);
+$ret = $testClient->testEnum(\ThriftTest\Numberz::ONE);
 print_r(" = $ret\n");
 
 print_r("testEnum(TWO)");
-$ret = $testClient->testEnum(ThriftTest_Numberz::TWO);
+$ret = $testClient->testEnum(\ThriftTest\Numberz::TWO);
 print_r(" = $ret\n");
 
 print_r("testEnum(THREE)");
-$ret = $testClient->testEnum(ThriftTest_Numberz::THREE);
+$ret = $testClient->testEnum(\ThriftTest\Numberz::THREE);
 print_r(" = $ret\n");
 
 print_r("testEnum(FIVE)");
-$ret = $testClient->testEnum(ThriftTest_Numberz::FIVE);
+$ret = $testClient->testEnum(\ThriftTest\Numberz::FIVE);
 print_r(" = $ret\n");
 
 print_r("testEnum(EIGHT)");
-$ret = $testClient->testEnum(ThriftTest_Numberz::EIGHT);
+$ret = $testClient->testEnum(\ThriftTest\Numberz::EIGHT);
 print_r(" = $ret\n");
 
 /**
@@ -302,7 +302,7 @@ print_r("}\n");
  * INSANITY TEST
  */
 $insane = new \ThriftTest\Insanity();
-$insane->userMap[ThriftTest_Numberz::FIVE] = 5000;
+$insane->userMap[\ThriftTest\Numberz::FIVE] = 5000;
 $truck = new \ThriftTest\Xtruct();
 $truck->string_thing = "Truck";
 $truck->byte_thing = 8;
@@ -348,7 +348,7 @@ print_r("testException('Xception')");
 try {
   $testClient->testException('Xception');
   print_r("  void\nFAILURE\n");
-} catch (ThriftTest_Xception $x) {
+} catch (\ThriftTest\Xception $x) {
   print_r(' caught xception '.$x->errorCode.': '.$x->message."\n");
 }