diff options
author | Bryan Duxbury <bryanduxbury@apache.org> | 2011-03-04 00:49:40 +0000 |
---|---|---|
committer | Bryan Duxbury <bryanduxbury@apache.org> | 2011-03-04 00:49:40 +0000 |
commit | a971fb094877b4245142c45abe67fc4e5568af30 (patch) | |
tree | ac042255ee213606b3a7e64a817cc19b35537ba6 /test/php | |
parent | a2cceb4396e89f02b9724e3f6dada3c534eacea1 (diff) | |
download | thrift-a971fb094877b4245142c45abe67fc4e5568af30.tar.gz |
THRIFT-1081. php: PHP tests broken and somewhat incomplete
This patch fixes some minor bugs and includes a test for Framed Transport.
Patch: Nicholas Telford
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1076908 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/php')
-rw-r--r-- | test/php/TestClient.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/php/TestClient.php b/test/php/TestClient.php index 6a06367d8..653b86507 100644 --- a/test/php/TestClient.php +++ b/test/php/TestClient.php @@ -1,3 +1,4 @@ +<?php /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +18,6 @@ * under the License. */ -<?php - if (!isset($GEN_DIR)) { $GEN_DIR = 'gen-php'; } @@ -39,6 +38,7 @@ require_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php'; require_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocketPool.php'; /** Include the socket layer */ +require_once $GLOBALS['THRIFT_ROOT'].'/transport/TFramedTransport.php'; require_once $GLOBALS['THRIFT_ROOT'].'/transport/TBufferedTransport.php'; echo '==============================='."\n"; @@ -73,6 +73,11 @@ $socket->setDebug(TRUE); if ($MODE == 'inline') { $transport = $socket; $testClient = new ThriftTestClient($transport); +} else if ($MODE == 'framed') { + $framedSocket = new TFramedTransport($socket); + $transport = $framedSocket; + $protocol = new TBinaryProtocol($transport); + $testClient = new ThriftTestClient($protocol); } else { $bufferedSocket = new TBufferedTransport($socket, 1024, 1024); $transport = $bufferedSocket; @@ -317,7 +322,7 @@ foreach ($whoa as $key => $val) { print_r("$k2 => {"); $userMap = $v2->userMap; print_r("{"); - if (is_array($usermap)) { + if (is_array($userMap)) { foreach ($userMap as $k3 => $v3) { print_r("$k3 => $v3, "); } @@ -347,7 +352,7 @@ print_r("testException('Xception')"); try { $testClient->testException('Xception'); print_r(" void\nFAILURE\n"); -} catch (Xception $x) { +} catch (ThriftTest_Xception $x) { print_r(' caught xception '.$x->errorCode.': '.$x->message."\n"); } @@ -395,4 +400,3 @@ if ($num != $num2) { $transport->close(); return; -?> |