> $expectedResult = array( "4" => array( "1" => 1, "2" => 2, "3" => 3, "4" => 4 ), "-4" => array( "-4" => -4, "-3" => -3, "-2" => -2, "-1" => -1 ) ); return $expectedResult; } function testException($m) { switch ($m) { case 'Xception': case 'ApplicationException': throw new ThriftTest_Xception( array( 'errorCode' => 1001, 'message' => "$m" ) ); break; default: break; } } function testInsanity() { $xtruct1 = new ThriftTest_Xtruct( array( 'string_thing' => 'Goodbye4', 'byte_thing' => 4, 'i32_thing' => 4, 'i64_thing' => 4 ) ); $xtruct2 = new ThriftTest_Xtruct( array( 'string_thing' => 'Hello2', 'byte_thing' =>2, 'i32_thing' => 2, 'i64_thing' => 2 ) ); $userMap = array( Numberz::FIVE => 5, Numberz::EIGHT => 8 ); $insanity2 = new ThriftTest_Insanity( array( 'userMap' => $userMap, 'xtructs' => array($xtruct1,$xtruct2) ) ); $insanity3 = $insanity2; $insanity6 = new ThriftTest_Insanity( array( 'userMap' => null, 'xtructs' => null ) ); return array( "1" => array( Numberz::TWO => $insanity2, Numberz::THREE => $insanity3 ), "2" => array( Numberz::SIX => $insanity6 ) ); } } $handler = new ThriftTestHandler(); $processor = new ThriftTestProcessor($handler); $tinput = new TPhpStream(TPhpStream::MODE_R); $toutput = new TPhpStream(TPhpStream::MODE_W); $tinput->open(); $toutput->open(); $pinput = new TJSONProtocol($tinput); $poutput = new TJSONProtocol($toutput); /*** * for binary tests */ //$pinput = new TBinaryProtocol($tinput); //$poutput = new TBinaryProtocol($toutput); $processor->process($pinput,$poutput);