From: Roger Meier Date: Sun, 6 Jan 2013 19:10:42 +0000 (+0100) Subject: THRIFT-1822 PHP unit test does not work X-Git-Tag: 0.9.1~205 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=87afaacb957e39f2100271180329dd7d718516e8;p=common%2Fthrift.git THRIFT-1822 PHP unit test does not work Patch: Roger Meier --- 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 06c6ab24..d5aa69c6 --- 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}]}}'; diff --git a/test/php/TestClient.php b/test/php/TestClient.php index 4df498c8..c334aeea 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"); }