THRIFT-5757: finish PHP cross-test integration
diff --git a/test/php/Handler.php b/test/php/Handler.php
index 3ea1f58..a03554c 100644
--- a/test/php/Handler.php
+++ b/test/php/Handler.php
@@ -89,31 +89,87 @@
public function testMapMap($hello)
{
- return $hello;
+ return [
+ -4 => [
+ -4 => -4,
+ -3 => -3,
+ -2 => -2,
+ -1 => -1,
+ ],
+ 4 => [
+ 4 => 4,
+ 3 => 3,
+ 2 => 2,
+ 1 => 1,
+ ],
+ ];
}
public function testInsanity(\ThriftTest\Insanity $argument)
{
- return $argument;
+ $looney = new \ThriftTest\Insanity();
+
+ return [
+ 1 => [
+ \ThriftTest\Numberz::TWO => $argument,
+ \ThriftTest\Numberz::THREE => $argument,
+ ],
+ 2 => [
+ \ThriftTest\Numberz::SIX => $looney,
+ ],
+ ];
}
public function testMulti($arg0, $arg1, $arg2, array $arg3, $arg4, $arg5)
{
- // TODO: Implement testMulti() method.
+ $result = new \ThriftTest\Xtruct();
+ $result->string_thing = 'Hello2';
+ $result->byte_thing = $arg0;
+ $result->i32_thing = $arg1;
+ $result->i64_thing = $arg2;
+
+ return $result;
}
public function testException($arg)
{
- throw new \Exception($arg);
+ if ($arg === 'Xception') {
+ $exception = new \ThriftTest\Xception();
+ $exception->errorCode = 1001;
+ $exception->message = $arg;
+ throw $exception;
+ }
+
+ if ($arg === 'TException') {
+ throw new \Thrift\Exception\TException('This is a TException');
+ }
}
public function testMultiException($arg0, $arg1)
{
- throw new \Exception($arg0, $arg1);
+ if ($arg0 === 'Xception') {
+ $exception = new \ThriftTest\Xception();
+ $exception->errorCode = 1001;
+ $exception->message = 'This is an Xception';
+ throw $exception;
+ }
+
+ if ($arg0 === 'Xception2') {
+ $exception = new \ThriftTest\Xception2();
+ $exception->errorCode = 2002;
+ $exception->struct_thing = new \ThriftTest\Xtruct();
+ $exception->struct_thing->string_thing = 'This is an Xception2';
+ throw $exception;
+ }
+
+ $result = new \ThriftTest\Xtruct();
+ $result->string_thing = $arg1;
+
+ return $result;
}
public function testOneway($secondsToSleep)
{
- sleep($secondsToSleep);
+ usleep($secondsToSleep * 300000);
}
}