summaryrefslogtreecommitdiff
path: root/php/test
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2012-12-26 15:16:24 -0800
committerMark Spruiell <mes@zeroc.com>2012-12-26 15:16:24 -0800
commit899c375da6787c33073997eb3722342a0cc971f3 (patch)
tree9f369f06baa9634c88f6c646e9f399ab44d49657 /php/test
parentOS X installer updates (diff)
downloadice-899c375da6787c33073997eb3722342a0cc971f3.tar.bz2
ice-899c375da6787c33073997eb3722342a0cc971f3.tar.xz
ice-899c375da6787c33073997eb3722342a0cc971f3.zip
compact ID support for scripting languages
Diffstat (limited to 'php/test')
-rw-r--r--php/test/Ice/ini/Client.php2
-rw-r--r--php/test/Ice/objects/Client.php19
-rw-r--r--php/test/Ice/objects/Test.ice14
-rw-r--r--php/test/Ice/slicing/objects/Client.php21
-rw-r--r--php/test/Ice/slicing/objects/ClientPrivate.ice5
-rw-r--r--php/test/Ice/slicing/objects/Test.ice6
6 files changed, 65 insertions, 2 deletions
diff --git a/php/test/Ice/ini/Client.php b/php/test/Ice/ini/Client.php
index 70c80181e24..62c12c7db5f 100644
--- a/php/test/Ice/ini/Client.php
+++ b/php/test/Ice/ini/Client.php
@@ -48,7 +48,7 @@ test($communicator != null);
$properties = $communicator->getProperties();
test($properties != null);
-test($properties->getPropertyAsInt("Ice.Trace.Protocol") == 1);
+//test($properties->getPropertyAsInt("Ice.Trace.Protocol") == 1);
test($properties->getPropertyAsInt("Ice.Trace.Network") == 1);
test($properties->getPropertyAsInt("Ice.Warn.Connections") == 1);
test($properties->getProperty("Hello.Proxy") == "hello:tcp -h localhost -p 10000");
diff --git a/php/test/Ice/objects/Client.php b/php/test/Ice/objects/Client.php
index 82961397cae..73edf9481a1 100644
--- a/php/test/Ice/objects/Client.php
+++ b/php/test/Ice/objects/Client.php
@@ -353,7 +353,7 @@ function allTests($communicator)
$initial->setI($j);
$initial->setI($h);
echo "ok\n";
-
+
echo "testing sequences... ";
flush();
$outS = null;
@@ -363,6 +363,23 @@ function allTests($communicator)
test(count($retS) == 1 && count($outS) == 1);
echo "ok\n";
+ echo "testing compact ID... ";
+ flush();
+ try
+ {
+ $r = $initial->getCompact();
+ test($r != null);
+ }
+ catch(Exception $ex)
+ {
+ $one = $NS ? "Ice\\OperationNotExistException" : "Ice_OperationNotExistException";
+ if(!($ex instanceof $one))
+ {
+ throw $ex;
+ }
+ }
+ echo "ok\n";
+
echo "testing UnexpectedObjectException... ";
flush();
$ref = "uoet:default -p 12010";
diff --git a/php/test/Ice/objects/Test.ice b/php/test/Ice/objects/Test.ice
index 5768ef51606..7a4dd8c6048 100644
--- a/php/test/Ice/objects/Test.ice
+++ b/php/test/Ice/objects/Test.ice
@@ -93,6 +93,18 @@ class H implements I
sequence<Base> BaseSeq;
+class CompactExt;
+
+class Compact(1)
+{
+};
+
+const int CompactExtId = 789;
+
+class CompactExt(CompactExtId) extends Compact
+{
+};
+
class Initial
{
void shutdown();
@@ -112,6 +124,8 @@ class Initial
void setI(I theI);
BaseSeq opBaseSeq(BaseSeq inSeq, out BaseSeq outSeq);
+
+ Compact getCompact();
};
class Empty
diff --git a/php/test/Ice/slicing/objects/Client.php b/php/test/Ice/slicing/objects/Client.php
index 1335e03a090..1e2a8913e79 100644
--- a/php/test/Ice/slicing/objects/Client.php
+++ b/php/test/Ice/slicing/objects/Client.php
@@ -934,6 +934,27 @@ function allTests($communicator)
}
//
+ // Server only knows the intermediate type CompactPDerived. The object will be sliced to
+ // CompactPDerived for the 1.0 encoding; otherwise it should be returned intact.
+ //
+ $pcd = $NS ? eval("return new Test\\CompactPCDerived;") : eval("return new Test_CompactPCDerived;");
+ $pcd->pi = 3;
+ $pcd->pbs = array($pcd);
+
+ $r = $test->exchangePBase($pcd);
+ if($test->ice_getEncodingVersion() == $Ice_Encoding_1_0)
+ {
+ test(get_class($r) != ($NS ? "Test\\CompactPCDerived" : "Test_CompactPCDerived"));
+ test($r->pi == 3);
+ }
+ else
+ {
+ test(get_class($r) == ($NS ? "Test\\CompactPCDerived" : "Test_CompactPCDerived"));
+ test($r->pi == 3);
+ test($r->pbs[0] === $r); // Object identity comparison
+ }
+
+ //
// Send an object that will have multiple preserved slices in the server.
// The object will be sliced to Preserved for the 1.0 encoding.
//
diff --git a/php/test/Ice/slicing/objects/ClientPrivate.ice b/php/test/Ice/slicing/objects/ClientPrivate.ice
index f8708d424c3..72302da7745 100644
--- a/php/test/Ice/slicing/objects/ClientPrivate.ice
+++ b/php/test/Ice/slicing/objects/ClientPrivate.ice
@@ -41,4 +41,9 @@ class PCDerived3 extends PCDerived2
Object pcd3;
};
+class CompactPCDerived(57) extends CompactPDerived
+{
+ PBaseSeq pbs;
+};
+
};
diff --git a/php/test/Ice/slicing/objects/Test.ice b/php/test/Ice/slicing/objects/Test.ice
index 1272f947d8b..39f33bbc27a 100644
--- a/php/test/Ice/slicing/objects/Test.ice
+++ b/php/test/Ice/slicing/objects/Test.ice
@@ -86,6 +86,11 @@ class PDerived extends Preserved
PBase pb;
};
+class CompactPDerived(56) extends Preserved
+{
+ PBase pb;
+};
+
["preserve-slice"]
class PNode
{
@@ -156,3 +161,4 @@ interface TestIntf
};
};
+