diff options
author | Mark Spruiell <mes@zeroc.com> | 2012-05-23 15:02:14 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2012-05-23 15:02:14 -0700 |
commit | 0ce3ea49125e83ba758c66ab6c88142315d047d3 (patch) | |
tree | 1d8c549acf22d5abeaa30fae67a292970f294a34 /php/test | |
parent | Added implementation of optional data members encoding (not tested yet) (diff) | |
download | ice-0ce3ea49125e83ba758c66ab6c88142315d047d3.tar.bz2 ice-0ce3ea49125e83ba758c66ab6c88142315d047d3.tar.xz ice-0ce3ea49125e83ba758c66ab6c88142315d047d3.zip |
PHP port; misc. fixes
Diffstat (limited to 'php/test')
-rw-r--r-- | php/test/Ice/exceptions/junk.php | 12 | ||||
-rwxr-xr-x | php/test/Ice/exceptions/run.py | 12 | ||||
-rw-r--r-- | php/test/Ice/info/Client.php | 10 | ||||
-rw-r--r-- | php/test/Ice/ini/Client.php | 6 | ||||
-rw-r--r-- | php/test/Ice/ini/ClientWithProfile.php | 8 | ||||
-rwxr-xr-x | php/test/Ice/objects/run.py | 5 | ||||
-rw-r--r-- | php/test/Ice/proxy/Client.php | 100 | ||||
-rw-r--r-- | php/test/Ice/slicing/exceptions/Client.php | 161 | ||||
-rw-r--r-- | php/test/Ice/slicing/exceptions/Test.ice | 44 | ||||
-rwxr-xr-x | php/test/Ice/slicing/exceptions/run.py | 3 | ||||
-rw-r--r-- | php/test/Ice/slicing/objects/Client.php | 255 | ||||
-rw-r--r-- | php/test/Ice/slicing/objects/ClientPrivate.ice | 21 | ||||
-rw-r--r-- | php/test/Ice/slicing/objects/Test.ice | 54 | ||||
-rwxr-xr-x | php/test/Ice/slicing/objects/run.py | 3 | ||||
-rw-r--r-- | php/test/Slice/structure/Client.php | 12 |
15 files changed, 603 insertions, 103 deletions
diff --git a/php/test/Ice/exceptions/junk.php b/php/test/Ice/exceptions/junk.php deleted file mode 100644 index d6a44f5c74d..00000000000 --- a/php/test/Ice/exceptions/junk.php +++ /dev/null @@ -1,12 +0,0 @@ -<!-- ********************************************************************** --> -<!-- --> -<!-- Copyright (c) 2003-2012 ZeroC, Inc. All rights reserved. --> -<!-- --> -<!-- This copy of Ice is licensed to you under the terms described in the --> -<!-- ICE_LICENSE file included in this distribution. --> -<!-- --> -<!-- ********************************************************************** --> - -<? -echo "value = ",PHP_CONFIG_FILE_PATH,"\n"; -?> diff --git a/php/test/Ice/exceptions/run.py b/php/test/Ice/exceptions/run.py index 0248812b4bb..7732c33648e 100755 --- a/php/test/Ice/exceptions/run.py +++ b/php/test/Ice/exceptions/run.py @@ -20,7 +20,15 @@ if len(path) == 0: sys.path.append(os.path.join(path[0], "scripts")) import TestUtil -print("tests with regular server.") +print("Running test with compact (default) format.") TestUtil.clientServerTest() -print("tests with AMD server.") +print("Running test with sliced format.") +TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") +print("Running test with 1.0 encoding.") +TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", additionalServerOptions="--Ice.Default.EncodingVersion=1.0") +print("Running test with compact (default) format and AMD server.") TestUtil.clientServerTest(server="serveramd") +print("Running test with sliced format and AMD server.") +TestUtil.clientServerTest(server="serveramd", additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") +print("Running test with 1.0 encoding and AMD server.") +TestUtil.clientServerTest(server="serveramd", additionalClientOptions="--Ice.Default.EncodingVersion=1.0", additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/php/test/Ice/info/Client.php b/php/test/Ice/info/Client.php index b936100f942..4bded0b35b6 100644 --- a/php/test/Ice/info/Client.php +++ b/php/test/Ice/info/Client.php @@ -39,18 +39,22 @@ function allTests($communicator) $udpEndpointType = $NS ? constant("Ice\\UDPEndpointType") : constant("Ice_UDPEndpointType"); $udpEndpointInfoClass = $NS ? "Ice\\UDPEndpointInfo" : "Ice_UDPEndpointInfo"; $sslEndpointType = 2; + $protocolVersionClass = $NS ? "Ice\\ProtocolVersion" : "Ice_ProtocolVersion"; + $encodingVersionClass = $NS ? "Ice\\EncodingVersion" : "Ice_EncodingVersion"; echo "testing proxy endpoint information... "; flush(); { - $p1 = $communicator->stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z:" . + $p1 = $communicator->stringToProxy("test -t:default -v 1.4 -e 1.3 -h tcphost -p 10000 -t 1200 -z:" . "udp -h udphost -p 10001 --interface eth0 --ttl 5:" . - "opaque -t 100 -v ABCD"); + "opaque -e 1.8 -t 100 -v ABCD"); $endps = $p1->ice_getEndpoints(); $ipEndpoint = $endps[0]->getInfo(); test($ipEndpoint instanceof $ipEndpointInfoClass); + test($ipEndpoint->protocol == eval("return new " . $protocolVersionClass . "(1, 4);")); + test($ipEndpoint->encoding == eval("return new " . $encodingVersionClass . "(1, 3);")); test($ipEndpoint->host == "tcphost"); test($ipEndpoint->port == 10000); test($ipEndpoint->timeout == 1200); @@ -63,6 +67,8 @@ function allTests($communicator) $udpEndpoint = $endps[1]->getInfo(); test($udpEndpoint instanceof $udpEndpointInfoClass); + test($udpEndpoint->protocol == Ice_currentProtocol()); + test($udpEndpoint->encoding == Ice_currentEncoding()); test($udpEndpoint->host == "udphost"); test($udpEndpoint->port == 10001); test($udpEndpoint->mcastInterface == "eth0"); diff --git a/php/test/Ice/ini/Client.php b/php/test/Ice/ini/Client.php index fa09f2ead78..70c80181e24 100644 --- a/php/test/Ice/ini/Client.php +++ b/php/test/Ice/ini/Client.php @@ -32,9 +32,9 @@ $communicator = null; if($NS) { - $initData = eval("new Ice\\InitializationData;"); - $initData->properties = eval("Ice\\getProperties();"); - $communicator = eval("Ice\\initialize($initData);"); + $initData = eval("return new Ice\\InitializationData;"); + $initData->properties = eval("return Ice\\getProperties();"); + $communicator = eval("return Ice\\initialize(\$initData);"); } else { diff --git a/php/test/Ice/ini/ClientWithProfile.php b/php/test/Ice/ini/ClientWithProfile.php index b60fd3ed04a..7d8da674b7c 100644 --- a/php/test/Ice/ini/ClientWithProfile.php +++ b/php/test/Ice/ini/ClientWithProfile.php @@ -37,9 +37,9 @@ $communicator = null; if($NS) { - $initData = eval("new Ice\\InitializationData;"); - $initData->properties = eval("Ice\\getProperties();"); - $communicator = eval("Ice\\initialize($initData);"); + $initData = eval("return new Ice\\InitializationData;"); + $initData->properties = eval("return Ice\\getProperties();"); + $communicator = eval("return Ice\\initialize(\$initData);"); } else { @@ -53,7 +53,7 @@ test($communicator != null); $properties = null; if($NS) { - $properties = eval("Ice\\getProperties(\"Test\");"); + $properties = eval("return Ice\\getProperties(\"Test\");"); } else { diff --git a/php/test/Ice/objects/run.py b/php/test/Ice/objects/run.py index 751a8e1d456..3d61174d3d1 100755 --- a/php/test/Ice/objects/run.py +++ b/php/test/Ice/objects/run.py @@ -20,4 +20,9 @@ if len(path) == 0: sys.path.append(os.path.join(path[0], "scripts")) import TestUtil +print("Running test with compact (default) format.") TestUtil.clientServerTest() +print("Running test with sliced format.") +TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") +print("Running test with 1.0 encoding.") +TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/php/test/Ice/proxy/Client.php b/php/test/Ice/proxy/Client.php index 4747643ff0a..9991bdb6813 100644 --- a/php/test/Ice/proxy/Client.php +++ b/php/test/Ice/proxy/Client.php @@ -32,9 +32,12 @@ function test($b) function allTests($communicator) { global $NS; + global $Ice_Encoding_1_0; + global $Ice_Encoding_1_1; $random = $NS ? constant("Ice\\EndpointSelectionType::Random") : constant("Ice_EndpointSelectionType::Random"); $ordered = $NS ? constant("Ice\\EndpointSelectionType::Ordered") : constant("Ice_EndpointSelectionType::Ordered"); + $encodingVersion = $NS ? "Ice\\EncodingVersion" : "Ice_EncodingVersion"; echo "testing stringToProxy... "; flush(); @@ -368,6 +371,42 @@ function allTests($communicator) //test(!$b1->ice_isCollocationOptimized()); //$communicator->getProperties()->setProperty($property, ""); + $property = $propertyPrefix . ".EncodingVersion"; + test($b1->ice_getEncodingVersion() == Ice_currentEncoding()); + $communicator->getProperties()->setProperty($property, "1.0"); + $b1 = $communicator->propertyToProxy($propertyPrefix); + test($b1->ice_getEncodingVersion()->major == 1 && $b1->ice_getEncodingVersion()->minor == 0); + $communicator->getProperties()->setProperty($property, "6.5"); + try + { + $communicator->propertyToProxy($propertyPrefix); + test(false); + } + catch(Exception $ex) + { + $cls = $NS ? "Ice\\UnsupportedEncodingException" : "Ice_UnsupportedEncodingException"; + if(!($ex instanceof $cls)) + { + throw $ex; + } + } + + $communicator->getProperties()->setProperty($property, "1.2"); + try + { + $communicator->propertyToProxy($propertyPrefix); + test(false); + } + catch(Exception $ex) + { + $cls = $NS ? "Ice\\UnsupportedEncodingException" : "Ice_UnsupportedEncodingException"; + if(!($ex instanceof $cls)) + { + throw $ex; + } + } + $communicator->getProperties()->setProperty($property, ""); + echo "ok\n"; echo "testing proxyToProperty... "; @@ -379,6 +418,7 @@ function allTests($communicator) $b1 = $b1->ice_preferSecure(false); $b1 = $b1->ice_endpointSelection($ordered); $b1 = $b1->ice_locatorCacheTimeout(100); + $b1 = $b1->ice_encodingVersion(eval("return new " . $encodingVersion . "(1, 0);")); $router = $communicator->stringToProxy("router"); //$router = $router->ice_collocationOptimized(false); @@ -398,10 +438,11 @@ function allTests($communicator) $b1 = $b1->ice_locator($locator->ice_uncheckedCast("::Ice::Locator")); $proxyProps = $communicator->proxyToProperty($b1, "Test"); - test(count($proxyProps) == 18); + test(count($proxyProps) == 21); test($proxyProps["Test"] == "test -t"); //test($proxyProps["Test.CollocationOptimized"] == "1"); + test($proxyProps["Test.EncodingVersion"] == "1.0"); test($proxyProps["Test.ConnectionCached"] == "1"); test($proxyProps["Test.PreferSecure"] == "0"); test($proxyProps["Test.EndpointSelection"] == "Ordered"); @@ -409,6 +450,7 @@ function allTests($communicator) test($proxyProps["Test.Locator"] == "locator -t"); //test($proxyProps["Test.Locator.CollocationOptimized"] == "1"); + test($proxyProps["Test.Locator.EncodingVersion"] == Ice_encodingVersionToString(Ice_currentEncoding())); test($proxyProps["Test.Locator.ConnectionCached"] == "0"); test($proxyProps["Test.Locator.PreferSecure"] == "1"); test($proxyProps["Test.Locator.EndpointSelection"] == "Random"); @@ -416,11 +458,31 @@ function allTests($communicator) test($proxyProps["Test.Locator.Router"] == "router -t"); //test($proxyProps["Test.Locator.Router.CollocationOptimized"] == "0"); + test($proxyProps["Test.Locator.Router.EncodingVersion"] == Ice_encodingVersionToString(Ice_currentEncoding())); test($proxyProps["Test.Locator.Router.ConnectionCached"] == "1"); test($proxyProps["Test.Locator.Router.PreferSecure"] == "1"); test($proxyProps["Test.Locator.Router.EndpointSelection"] == "Random"); test($proxyProps["Test.Locator.Router.LocatorCacheTimeout"] == "200"); + try + { + $b1->ice_encodingVersion(eval("return new " . $encodingVersion . "(3, 4);")); + test(false); + } + catch(Exception $ex) + { + $cls = $NS ? "Ice\\UnsupportedEncodingException" : "Ice_UnsupportedEncodingException"; + if(!($ex instanceof $cls)) + { + throw $ex; + } + } + + echo "ok\n"; + + echo "testing ice_getCommunicator... "; + flush(); + test($base->ice_getCommunicator() === $communicator); echo "ok\n"; echo "testing proxy methods... "; @@ -435,16 +497,16 @@ function allTests($communicator) test($base->ice_batchDatagram()->ice_isBatchDatagram()); test($base->ice_secure(true)->ice_isSecure()); test(!$base->ice_secure(false)->ice_isSecure()); + test($base->ice_preferSecure(true)->ice_isPreferSecure()); + test(!$base->ice_preferSecure(false)->ice_isPreferSecure()); test($base->ice_connectionId("id1")->ice_getConnectionId() == "id1"); test($base->ice_connectionId("id2")->ice_getConnectionId() == "id2"); + test($base->ice_encodingVersion($Ice_Encoding_1_0)->ice_getEncodingVersion() == $Ice_Encoding_1_0); + test($base->ice_encodingVersion($Ice_Encoding_1_1)->ice_getEncodingVersion() == $Ice_Encoding_1_1); + test($base->ice_encodingVersion($Ice_Encoding_1_0)->ice_getEncodingVersion() != $Ice_Encoding_1_1); echo "ok\n"; - echo "testing ice_getCommunicator... "; - flush(); - test($base->ice_getCommunicator() === $communicator); - echo "ok\n"; - echo "testing checked cast... "; flush(); $cl = $base->ice_checkedCast("::Test::MyClass"); @@ -637,11 +699,19 @@ function allTests($communicator) } } - // Legal TCP endpoint expressed as opaque endpoint - $p1 = $communicator->stringToProxy("test:opaque -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); + // Legal TCP endpoint expressed as opaque endpoint. + $p1 = $communicator->stringToProxy("test:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); $pstr = $communicator->proxyToString($p1); test($pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000"); + // 1.1 TCP endpoint encoded with 1.1 encoding. + $p2 = $communicator->stringToProxy("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQE="); + test($communicator->proxyToString($p2) == "test -t:tcp -e 1.1 -h 127.0.0.1 -p 12010 -t 10000"); + + // 1.0 TCP endpoint encoded with 1.1 encoding. + $p2 = $communicator->stringToProxy("test: opaque -t 1 -e 1.1 -v CTEyNy4wLjAuMeouAAAQJwAAAAEAAQA="); + test($communicator->proxyToString($p2) == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000"); + // Working? if($communicator->getProperties()->getProperty("Ice.IPv6") == "" || $communicator->getProperties()->getProperty("Ice.IPv6") == "0") @@ -649,11 +719,11 @@ function allTests($communicator) $ssl = $communicator->getProperties()->getProperty("Ice.Default.Protocol") == "ssl"; if(!$ssl) { - $p1->ice_ping(); + $p1->ice_encodingVersion($Ice_Encoding_1_0)->ice_ping(); } // Two legal TCP endpoints expressed as opaque endpoints - $p1 = $communicator->stringToProxy("test:opaque -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); + $p1 = $communicator->stringToProxy("test:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); $pstr = $communicator->proxyToString($p1); test($pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000"); @@ -661,11 +731,11 @@ function allTests($communicator) // Test that an SSL endpoint and a nonsense endpoint get written // back out as an opaque endpoint. // - $p1 = $communicator->stringToProxy("test:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch"); + $p1 = $communicator->stringToProxy("test:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch"); $pstr = $communicator->proxyToString($p1); if(!$ssl) { - test($pstr == "test -t:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch"); + test($pstr == "test -t:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch"); } else { @@ -679,7 +749,7 @@ function allTests($communicator) // try { - $p1->ice_ping(); + $p1->ice_encodingVersion($Ice_Encoding_1_0)->ice_ping(); test(false); } catch(Exception $ex) @@ -710,11 +780,11 @@ function allTests($communicator) $pstr = $communicator->proxyToString($p2); if(!$ssl) { - test($pstr == "test -t:opaque -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -v abch"); + test($pstr == "test -t:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch"); } else { - test($pstr == "test -t:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -v abch"); + test($pstr == "test -t:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch"); } } echo "ok\n"; diff --git a/php/test/Ice/slicing/exceptions/Client.php b/php/test/Ice/slicing/exceptions/Client.php index ff114ac5b20..5646e7b4c78 100644 --- a/php/test/Ice/slicing/exceptions/Client.php +++ b/php/test/Ice/slicing/exceptions/Client.php @@ -23,11 +23,12 @@ function test($b) function allTests($communicator) { global $NS; + global $Ice_Encoding_1_0; $obj = $communicator->stringToProxy("Test:default -p 12010"); $test = $obj->ice_checkedCast("::Test::TestIntf"); - echo "testing throwing a base exception... "; + echo "base... "; flush(); { try @@ -40,7 +41,7 @@ function allTests($communicator) $excls = $NS ? "Test\\Base" : "Test_Base"; if(!($b instanceof $excls)) { - throw $ex; + throw $b; } test($b->b == "Base.b"); test(get_class($b) == ($NS ? "Test\\Base" : "Test_Base")); @@ -48,7 +49,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing slicing of unknown derived exception... "; + echo "unknown derived... "; flush(); { try @@ -61,7 +62,7 @@ function allTests($communicator) $excls = $NS ? "Test\\Base" : "Test_Base"; if(!($b instanceof $excls)) { - throw $ex; + throw $b; } test($b->b == "UnknownDerived.b"); test(get_class($b) == ($NS ? "Test\\Base" : "Test_Base")); @@ -69,7 +70,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing non-slicing of known derived exception thrown as base exception... "; + echo "non-slicing of known derived as base... "; flush(); { try @@ -82,7 +83,7 @@ function allTests($communicator) $excls = $NS ? "Test\\KnownDerived" : "Test_KnownDerived"; if(!($k instanceof $excls)) { - throw $ex; + throw $k; } test($k->b == "KnownDerived.b"); test($k->kd == "KnownDerived.kd"); @@ -91,7 +92,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing non-slicing of known derived exception thrown as derived exception... "; + echo "non-slicing of known derived as derived... "; flush(); { try @@ -104,7 +105,7 @@ function allTests($communicator) $excls = $NS ? "Test\\KnownDerived" : "Test_KnownDerived"; if(!($k instanceof $excls)) { - throw $ex; + throw $k; } test($k->b == "KnownDerived.b"); test($k->kd == "KnownDerived.kd"); @@ -113,7 +114,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing slicing of unknown intermediate exception thrown as base exception... "; + echo "slicing of unknown intermediate as base... "; flush(); { try @@ -126,7 +127,7 @@ function allTests($communicator) $excls = $NS ? "Test\\Base" : "Test_Base"; if(!($b instanceof $excls)) { - throw $ex; + throw $b; } test($b->b == "UnknownIntermediate.b"); test(get_class($b) == ($NS ? "Test\\Base" : "Test_Base")); @@ -134,7 +135,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing slicing of known intermediate exception thrown as base exception... "; + echo "slicing of known intermediate as base... "; flush(); { try @@ -147,7 +148,7 @@ function allTests($communicator) $excls = $NS ? "Test\\KnownIntermediate" : "Test_KnownIntermediate"; if(!($ki instanceof $excls)) { - throw $ex; + throw $ki; } test($ki->b == "KnownIntermediate.b"); test($ki->ki == "KnownIntermediate.ki"); @@ -156,7 +157,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing slicing of known most derived exception thrown as base exception... "; + echo "slicing of known most derived as base... "; flush(); { try @@ -169,7 +170,7 @@ function allTests($communicator) $excls = $NS ? "Test\\KnownMostDerived" : "Test_KnownMostDerived"; if(!($kmd instanceof $excls)) { - throw $ex; + throw $kmd; } test($kmd->b == "KnownMostDerived.b"); test($kmd->ki == "KnownMostDerived.ki"); @@ -179,7 +180,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing non-slicing of known intermediate exception thrown as intermediate exception... "; + echo "non-slicing of known intermediate as intermediate... "; flush(); { try @@ -192,7 +193,7 @@ function allTests($communicator) $excls = $NS ? "Test\\KnownIntermediate" : "Test_KnownIntermediate"; if(!($ki instanceof $excls)) { - throw $ex; + throw $ki; } test($ki->b == "KnownIntermediate.b"); test($ki->ki == "KnownIntermediate.ki"); @@ -201,7 +202,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing non-slicing of known most derived thrown as intermediate exception... "; + echo "non-slicing of known most derived as intermediate... "; flush(); { try @@ -214,7 +215,7 @@ function allTests($communicator) $excls = $NS ? "Test\\KnownMostDerived" : "Test_KnownMostDerived"; if(!($kmd instanceof $excls)) { - throw $ex; + throw $kmd; } test($kmd->b == "KnownMostDerived.b"); test($kmd->ki == "KnownMostDerived.ki"); @@ -224,7 +225,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing non-slicing of known most derived thrown as most derived exception... "; + echo "non-slicing of known most derived as most derived... "; flush(); { try @@ -237,7 +238,7 @@ function allTests($communicator) $excls = $NS ? "Test\\KnownMostDerived" : "Test_KnownMostDerived"; if(!($kmd instanceof $excls)) { - throw $ex; + throw $kmd; } test($kmd->b == "KnownMostDerived.b"); test($kmd->ki == "KnownMostDerived.ki"); @@ -247,7 +248,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing slicing of unknown most derived with known intermediate thrown as base exception... "; + echo "slicing of unknown most derived, known intermediate as base... "; flush(); { try @@ -260,7 +261,7 @@ function allTests($communicator) $excls = $NS ? "Test\\KnownIntermediate" : "Test_KnownIntermediate"; if(!($ki instanceof $excls)) { - throw $ex; + throw $ki; } test($ki->b == "UnknownMostDerived1.b"); test($ki->ki == "UnknownMostDerived1.ki"); @@ -269,7 +270,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing slicing of unknown most derived with known intermediate thrown as intermediate exception... "; + echo "slicing of unknown most derived, known intermediate as intermediate... "; flush(); { try @@ -282,7 +283,7 @@ function allTests($communicator) $excls = $NS ? "Test\\KnownIntermediate" : "Test_KnownIntermediate"; if(!($ki instanceof $excls)) { - throw $ex; + throw $ki; } test($ki->b == "UnknownMostDerived1.b"); test($ki->ki == "UnknownMostDerived1.ki"); @@ -291,7 +292,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing slicing of unknown most derived with unknown intermediate thrown as base exception... "; + echo "slicing of unknown most derived, unknown intermediate as base... "; flush(); { try @@ -304,7 +305,7 @@ function allTests($communicator) $excls = $NS ? "Test\\Base" : "Test_Base"; if(!($b instanceof $excls)) { - throw $ex; + throw $b; } test($b->b == "UnknownMostDerived2.b"); test(get_class($b) == ($NS ? "Test\\Base" : "Test_Base")); @@ -312,6 +313,114 @@ function allTests($communicator) } echo "ok\n"; + echo "unknown most derived in compact format... "; + flush(); + { + try + { + $test->unknownMostDerived2AsBaseCompact(); + test(false); + } + catch(Exception $b) + { + $excls = $NS ? "Test\\Base" : "Test_Base"; + if(($b instanceof $excls)) + if(get_class($b) == ($NS ? "Test\\Base" : "Test_Base")) + { + // + // For the 1.0 encoding, the unknown exception is sliced to Base. + // + test($test->ice_getEncodingVersion() == $Ice_Encoding_1_0); + } + else if(get_class($b) == ($NS ? "Ice\\MarshalException" : "Ice_MarshalException")) + { + // + // A MarshalException is raised for the compact format because the + // most-derived type is unknown and the exception cannot be sliced. + // + test($test->ice_getEncodingVersion() != $Ice_Encoding_1_0); + } + else + { + throw $b; + } + } + } + echo "ok\n"; + + echo "preserved exceptions... "; + flush(); + { + try + { + $test->knownPreservedAsBase(); + test(false); + } + catch(Exception $b) + { + $excls = $NS ? "Test\\KnownPreservedDerived" : "Test_KnownPreservedDerived"; + if(!($b instanceof $excls)) + { + throw $b; + } + test($b->b == "base"); + test($b->kp == "preserved"); + test($b->kpd == "derived"); + } + + try + { + $test->knownPreservedAsKnownPreserved(); + test(false); + } + catch(Exception $b) + { + $excls = $NS ? "Test\\KnownPreservedDerived" : "Test_KnownPreservedDerived"; + if(!($b instanceof $excls)) + { + throw $b; + } + test($b->b == "base"); + test($b->kp == "preserved"); + test($b->kpd == "derived"); + } + + try + { + $test->unknownPreservedAsBase(); + test(false); + } + catch(Exception $b) + { + $excls = $NS ? "Test\\KnownPreservedDerived" : "Test_KnownPreservedDerived"; + if(!($b instanceof $excls)) + { + throw $b; + } + test($b->b == "base"); + test($b->kp == "preserved"); + test($b->kpd == "derived"); + } + + try + { + $test->unknownPreservedAsKnownPreserved(); + test(false); + } + catch(Exception $b) + { + $excls = $NS ? "Test\\KnownPreservedDerived" : "Test_KnownPreservedDerived"; + if(!($b instanceof $excls)) + { + throw $b; + } + test($b->b == "base"); + test($b->kp == "preserved"); + test($b->kpd == "derived"); + } + } + echo "ok\n"; + return $test; } diff --git a/php/test/Ice/slicing/exceptions/Test.ice b/php/test/Ice/slicing/exceptions/Test.ice index 1c92fe0fbcf..e558935d440 100644 --- a/php/test/Ice/slicing/exceptions/Test.ice +++ b/php/test/Ice/slicing/exceptions/Test.ice @@ -32,7 +32,35 @@ exception KnownMostDerived extends KnownIntermediate string kmd; }; -["ami"] interface TestIntf +["preserve-slice"] +exception KnownPreserved extends Base +{ + string kp; +}; + +exception KnownPreservedDerived extends KnownPreserved +{ + string kpd; +}; + +["preserve-slice"] +class BaseClass +{ + string bc; +}; + +["format:sliced"] +interface Relay +{ + void knownPreservedAsBase() throws Base; + void knownPreservedAsKnownPreserved() throws KnownPreserved; + + void unknownPreservedAsBase() throws Base; + void unknownPreservedAsKnownPreserved() throws KnownPreserved; +}; + +["format:sliced"] +interface TestIntf { void baseAsBase() throws Base; void unknownDerivedAsBase() throws Base; @@ -50,6 +78,20 @@ exception KnownMostDerived extends KnownIntermediate void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; + ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; + + void knownPreservedAsBase() throws Base; + void knownPreservedAsKnownPreserved() throws KnownPreserved; + + void relayKnownPreservedAsBase(Relay* r) throws Base; + void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; + + void unknownPreservedAsBase() throws Base; + void unknownPreservedAsKnownPreserved() throws KnownPreserved; + + void relayUnknownPreservedAsBase(Relay* r) throws Base; + void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; + void shutdown(); }; diff --git a/php/test/Ice/slicing/exceptions/run.py b/php/test/Ice/slicing/exceptions/run.py index 286dd895700..9fde25714bd 100755 --- a/php/test/Ice/slicing/exceptions/run.py +++ b/php/test/Ice/slicing/exceptions/run.py @@ -20,4 +20,7 @@ if len(path) == 0: sys.path.append(os.path.join(path[0], "scripts")) import TestUtil +print("Running test with sliced format.") TestUtil.clientServerTest() +print("Running test with 1.0 encoding.") +TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/php/test/Ice/slicing/objects/Client.php b/php/test/Ice/slicing/objects/Client.php index 55d5ac1ad6e..e57f3b44269 100644 --- a/php/test/Ice/slicing/objects/Client.php +++ b/php/test/Ice/slicing/objects/Client.php @@ -24,6 +24,7 @@ function test($b) function allTests($communicator) { global $NS; + global $Ice_Encoding_1_0; $d1cls = $NS ? "Test\\D1" : "Test_D1"; $d3cls = $NS ? "Test\\D3" : "Test_D3"; @@ -31,7 +32,7 @@ function allTests($communicator) $obj = $communicator->stringToProxy("Test:default -p 12010"); $test = $obj->ice_checkedCast("::Test::TestIntf"); - echo "testing base as Object... "; + echo "base as Object... "; flush(); { $o = $test->SBaseAsObject(); @@ -41,7 +42,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing base as base... "; + echo "base as base... "; flush(); { $o = $test->SBaseAsSBase(); @@ -49,7 +50,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing base with known derived as base... "; + echo "base with known derived as base... "; flush(); { $sb = $test->SBSKnownDerivedAsSBase(); @@ -59,7 +60,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing base with known derived as known derived... "; + echo "base with known derived as known derived... "; flush(); { $sbksd = $test->SBSKnownDerivedAsSBSKnownDerived(); @@ -67,15 +68,46 @@ function allTests($communicator) } echo "ok\n"; - echo "testing base with unknown derived as base... "; + echo "base with unknown derived as base... "; flush(); { $sb = $test->SBSUnknownDerivedAsSBase(); test($sb->sb == "SBSUnknownDerived.sb"); } + if($test->ice_getEncodingVersion() == $Ice_Encoding_1_0) + { + try + { + // + // This test succeeds for the 1.0 encoding. + // + $sb = $test->SBSUnknownDerivedAsSBaseCompact(); + test($sb->sb == "SBSUnknownDerived.sb"); + } + catch(Exception $ex) + { + test(false); + } + } + else + { + try + { + // + // This test fails when using the compact format because the instance cannot + // be sliced to a known type. + // + $sb = $test->SBSUnknownDerivedAsSBaseCompact(); + test(false); + } + catch(Exception $ex) + { + test(get_class($ex) == ($NS ? "Ice\\MarshalException" : "Ice_MarshalException")); + } + } echo "ok\n"; - echo "testing unknown with Object as Object... "; + echo "unknown with Object as Object... "; flush(); { try @@ -94,7 +126,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing one-element cycle... "; + echo "one-element cycle... "; flush(); { $b = $test->oneElementCycle(); @@ -110,7 +142,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing two-element cycle... "; + echo "two-element cycle... "; flush(); { $b1 = $test->twoElementCycle(); @@ -131,7 +163,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing known derived pointer slicing as base... "; + echo "known derived pointer slicing as base... "; flush(); { $b1 = $test->D1AsB(); @@ -159,7 +191,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing known derived pointer slicing as derived... "; + echo "known derived pointer slicing as derived... "; flush(); { $d1 = $test->D1AsD1(); @@ -182,7 +214,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing unknown derived pointer slicing as base... "; + echo "unknown derived pointer slicing as base... "; flush(); { $b2 = $test->D2AsB(); @@ -210,7 +242,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing parameter pointer slicing with known first... "; + echo "parameter pointer slicing with known first... "; flush(); { $test->paramTest1($b1, $b2); @@ -236,7 +268,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing parameter pointer slicing with unknown first... "; + echo "parameter pointer slicing with unknown first... "; flush(); { $test->paramTest2($b2, $b1); @@ -262,7 +294,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing return value identity with known first... "; + echo "return value identity with known first... "; flush(); { $r = $test->returnTest1($p1, $p2); @@ -275,7 +307,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing return value identity with unknown first... "; + echo "return value identity with unknown first... "; flush(); { $r = $test->returnTest2($p1, $p2); @@ -288,7 +320,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing return value identity for input params known first... "; + echo "return value identity for input params known first... "; flush(); { $d1 = $NS ? eval("return new Test\\D1;") : eval("return new Test_D1;"); @@ -334,7 +366,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing return value identity for input params unknown first... "; + echo "return value identity for input params unknown first... "; flush(); { $d1 = $NS ? eval("return new Test\\D1;") : eval("return new Test_D1;"); @@ -380,7 +412,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing return value identity for input params unknown first... "; + echo "return value identity for input params unknown first... "; flush(); { $d1 = $NS ? eval("return new Test\\D1;") : eval("return new Test_D1;"); @@ -428,7 +460,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing remainder unmarshaling (3 instances)... "; + echo "remainder unmarshaling (3 instances)... "; flush(); { $ret = $test->paramTest3($p1, $p2); @@ -450,7 +482,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing remainder unmarshaling (4 instances)... "; + echo "remainder unmarshaling (4 instances)... "; flush(); { $ret = $test->paramTest4($b); @@ -467,7 +499,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing parameter pointer slicing with first instance marshaled in unknown derived as base... "; + echo "parameter pointer slicing with first instance marshaled in unknown derived as base... "; flush(); { $b1 = $NS ? eval("return new Test\\B;") : eval("return new Test_B;"); @@ -501,7 +533,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing parameter pointer slicing with first instance marshaled in unknown derived as derived... "; + echo "parameter pointer slicing with first instance marshaled in unknown derived as derived... "; flush(); { $d11 = $NS ? eval("return new Test\\D1;") : eval("return new Test_D1;"); @@ -540,7 +572,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing sequence slicing... "; + echo "sequence slicing... "; flush(); { $ss = null; @@ -632,7 +664,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing dictionary slicing... "; + echo "dictionary slicing... "; flush(); { $bin = array(); @@ -695,7 +727,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing base exception thrown as base exception... "; + echo "base exception thrown as base exception... "; flush(); { try @@ -724,7 +756,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing derived exception thrown as base exception... "; + echo "derived exception thrown as base exception... "; flush(); { try @@ -761,7 +793,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing derived exception thrown as derived exception... "; + echo "derived exception thrown as derived exception... "; flush(); { try @@ -798,7 +830,7 @@ function allTests($communicator) } echo "ok\n"; - echo "testing unknown derived exception thrown as base exception... "; + echo "unknown derived exception thrown as base exception... "; flush(); { try @@ -827,6 +859,173 @@ function allTests($communicator) } echo "ok\n"; + echo "forward-declared class... "; + flush(); + { + try + { + $f = null; + $test->useForward($f); + test($f != null); + } + catch(Exception $e) + { + test(false); + } + } + echo "ok\n"; + + echo "preserved classes... "; + flush(); + { + // + // Server knows the most-derived class PDerived. + // + $pd = $NS ? eval("return new Test\\PDerived;") : eval("return new Test_PDerived;"); + $pd->pi = 3; + $pd->ps = "preserved"; + $pd->pb = $pd; + + $r = $test->exchangePBase($pd); + test(get_class($r) == ($NS ? "Test\\PDerived" : "Test_PDerived")); + test($r->pi == 3); + test($r->ps == "preserved"); + test($r->pb === $r); // Object identity comparison + + // + // Server only knows the base (non-preserved) type, so the object is sliced. + // + $pu = $NS ? eval("return new Test\\PCUnknown;") : eval("return new Test_PCUnknown;"); + $pu->pi = 3; + $pu->pu = "preserved"; + + $r = $test->exchangePBase($pu); + test(get_class($r) != ($NS ? "Test\\PCUnknown" : "Test_PCUnknown")); + test($r->pi == 3); + + // + // Server only knows the intermediate type Preserved. The object will be sliced to + // Preserved for the 1.0 encoding; otherwise it should be returned intact. + // + $pcd = $NS ? eval("return new Test\\PCDerived;") : eval("return new Test_PCDerived;"); + $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\\PCDerived" : "Test_PCDerived")); + test($r->pi == 3); + } + else + { + test(get_class($r) == ($NS ? "Test\\PCDerived" : "Test_PCDerived")); + 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. + // + $pcd = $NS ? eval("return new Test\\PCDerived3;") : eval("return new Test_PCDerived3;"); + $pcd->pi = 3; + // + // Sending more than 254 objects exercises the encoding for object ids. + // + $pcd->pbs = array(); + for($i = 0; $i < 300; ++$i) + { + $p2 = $NS ? eval("return new Test\\PCDerived2;") : eval("return new Test_PCDerived2;"); + $p2->pi = $i; + $p2->pbs = array(null); // Nil reference. This slice should not have an indirection table. + $p2->pcd2 = $i; + array_push($pcd->pbs, $p2); + } + $pcd->pcd2 = $pcd->pi; + $pcd->pcd3 = $pcd->pbs[10]; + + $r = $test->exchangePBase($pcd); + if($test->ice_getEncodingVersion() == $Ice_Encoding_1_0) + { + test(get_class($r) != ($NS ? "Test\\PCDerived3" : "Test_PCDerived3")); + test(get_class($r) == ($NS ? "Test\\PDerived" : "Test_PDerived")); + test($r->pi == 3); + } + else + { + test(get_class($r) == ($NS ? "Test\\PCDerived3" : "Test_PCDerived3")); + test($r->pi == 3); + for($i = 0; $i < 300; ++$i) + { + $p2 = $r->pbs[$i]; + test(get_class($p2) == ($NS ? "Test\\PCDerived2" : "Test_PCDerived2")); + test($p2->pi == $i); + test(count($p2->pbs) == 1); + test($p2->pbs[0] == null); + test($p2->pcd2 == $i); + } + test($r->pcd2 == $r->pi); + test($r->pcd3 === $r->pbs[10]); // Object identity comparison + } + + // + // Obtain an object with preserved slices and send it back to the server. + // The preserved slices should be excluded for the 1.0 encoding, otherwise + // they should be included. + // + $p = $test->PBSUnknownAsPreserved(); + $test->checkPBSUnknown($p); + if($test->ice_getEncodingVersion() != $Ice_Encoding_1_0) + { + $test->ice_encodingVersion($Ice_Encoding_1_0)->checkPBSUnknown($p); + } + + // + // Relay a graph through the server. This test uses a preserved class + // with a class member. + // + $c = $NS ? eval("return new Test\\PNode;") : eval("return new Test_PNode;"); + $c->next = $NS ? eval("return new Test\\PNode;") : eval("return new Test_PNode;"); + $c->next->next = $NS ? eval("return new Test\\PNode;") : eval("return new Test_PNode;"); + $c->next->next->next = $c; // Create a cyclic graph. + + $n = $test->exchangePNode($c); + test($n->next != null); + test($n->next !== $n->next->next); // Object identity comparison + test($n->next->next !== $n->next->next->next); // Object identity comparison + test($n->next->next->next === $n); // Object identity comparison + $n = null; // Release reference. + + // + // Obtain a preserved object from the server where the most-derived + // type is unknown. The preserved slice refers to a graph of PNode + // objects. + // + $p = $test->PBSUnknownAsPreservedWithGraph(); + test($p != null); + $test->checkPBSUnknownWithGraph($p); + $p = null; // Release reference. + + // + // Obtain a preserved object from the server where the most-derived + // type is unknown. A data member in the preserved slice refers to the + // outer object, so the chain of references looks like this: + // + // outer->slicedData->outer + // + $p = $test->PBSUnknown2AsPreservedWithGraph(); + test($p != null); + if($test->ice_getEncodingVersion() != $Ice_Encoding_1_0) + { + test($p->_ice_slicedData != null); + } + $test->checkPBSUnknown2WithGraph($p); + $p->_ice_slicedData = null; // Break the cycle. + $p = null; // Release reference. + } + echo "ok\n"; + return $test; } diff --git a/php/test/Ice/slicing/objects/ClientPrivate.ice b/php/test/Ice/slicing/objects/ClientPrivate.ice index b4e22a0d495..f8708d424c3 100644 --- a/php/test/Ice/slicing/objects/ClientPrivate.ice +++ b/php/test/Ice/slicing/objects/ClientPrivate.ice @@ -20,4 +20,25 @@ class D3 extends B B pd3; }; +["preserve-slice"] +class PCUnknown extends PBase +{ + string pu; +}; + +class PCDerived extends PDerived +{ + PBaseSeq pbs; +}; + +class PCDerived2 extends PCDerived +{ + int pcd2; +}; + +class PCDerived3 extends PCDerived2 +{ + Object pcd3; +}; + }; diff --git a/php/test/Ice/slicing/objects/Test.ice b/php/test/Ice/slicing/objects/Test.ice index 509a6544f25..8e20db55def 100644 --- a/php/test/Ice/slicing/objects/Test.ice +++ b/php/test/Ice/slicing/objects/Test.ice @@ -46,7 +46,7 @@ class SS2 BSeq s; }; -struct SS +struct SS3 { SS1 c1; SS2 c2; @@ -66,9 +66,39 @@ exception DerivedException extends BaseException D1 pd1; }; -class Forward; // Forward-declared class defined in another compilation unit +class Forward; /* Forward-declared class defined in another compilation unit */ -["ami"] interface TestIntf +class PBase +{ + int pi; +}; + +sequence<PBase> PBaseSeq; + +["preserve-slice"] +class Preserved extends PBase +{ + string ps; +}; + +class PDerived extends Preserved +{ + PBase pb; +}; + +["preserve-slice"] +class PNode +{ + PNode next; +}; + +["preserve-slice"] +exception PreservedException +{ +}; + +["format:sliced"] +interface TestIntf { Object SBaseAsObject(); SBase SBaseAsSBase(); @@ -77,6 +107,8 @@ class Forward; // Forward-declared class defined in another compilation SBase SBSUnknownDerivedAsSBase(); + ["format:compact"] SBase SBSUnknownDerivedAsSBaseCompact(); + Object SUnknownAsObject(); B oneElementCycle(); @@ -94,14 +126,28 @@ class Forward; // Forward-declared class defined in another compilation B returnTest2(out B p2, out B p1); B returnTest3(B p1, B p2); - SS sequenceTest(SS1 p1, SS2 p2); + SS3 sequenceTest(SS1 p1, SS2 p2); BDict dictionaryTest(BDict bin, out BDict bout); + PBase exchangePBase(PBase pb); + + Preserved PBSUnknownAsPreserved(); + void checkPBSUnknown(Preserved p); + + ["amd"] Preserved PBSUnknownAsPreservedWithGraph(); + void checkPBSUnknownWithGraph(Preserved p); + + ["amd"] Preserved PBSUnknown2AsPreservedWithGraph(); + void checkPBSUnknown2WithGraph(Preserved p); + + PNode exchangePNode(PNode pn); + void throwBaseAsBase() throws BaseException; void throwDerivedAsBase() throws BaseException; void throwDerivedAsDerived() throws DerivedException; void throwUnknownDerivedAsBase() throws BaseException; + ["amd"] void throwPreservedException() throws PreservedException; void useForward(out Forward f); /* Use of forward-declared class to verify that code is generated correctly. */ diff --git a/php/test/Ice/slicing/objects/run.py b/php/test/Ice/slicing/objects/run.py index 286dd895700..9fde25714bd 100755 --- a/php/test/Ice/slicing/objects/run.py +++ b/php/test/Ice/slicing/objects/run.py @@ -20,4 +20,7 @@ if len(path) == 0: sys.path.append(os.path.join(path[0], "scripts")) import TestUtil +print("Running test with sliced format.") TestUtil.clientServerTest() +print("Running test with 1.0 encoding.") +TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/php/test/Slice/structure/Client.php b/php/test/Slice/structure/Client.php index 51c72baa3e3..d0c37f10e0a 100644 --- a/php/test/Slice/structure/Client.php +++ b/php/test/Slice/structure/Client.php @@ -40,9 +40,9 @@ function allTests($communicator) // Define some default values. // $def_s2 = $NS ? - eval("new Test\\S2(true, 98, 99, 100, 101, 1.0, 2.0, \"string\", array(\"one\", \"two\", \"three\"), - array(\"abc\" => \"def\"), new Test\\S1(\"name\"), new Test\\C(5), - $communicator->stringToProxy(\"test\"));") : + eval("return new Test\\S2(true, 98, 99, 100, 101, 1.0, 2.0, \"string\", array(\"one\", \"two\", \"three\"), + array(\"abc\" => \"def\"), new Test\\S1(\"name\"), new Test\\C(5), + \$communicator->stringToProxy(\"test\"));") : new Test_S2(true, 98, 99, 100, 101, 1.0, 2.0, "string", array("one", "two", "three"), array("abc" => "def"), new Test_S1("name"), new Test_C(5), $communicator->stringToProxy("test")); @@ -50,7 +50,7 @@ function allTests($communicator) // // Compare default-constructed structures. // - test($NS ? eval("new Test\\S2 == new Test\\S2;") : new Test_S2 == new Test_S2); + test($NS ? eval("return new Test\\S2 == new Test\\S2;") : new Test_S2 == new Test_S2); // // Change one primitive member at a time. @@ -167,11 +167,11 @@ function allTests($communicator) test($v1 == $def_s2); $v1 = clone $def_s2; - $v1->s = $NS ? eval("new Test\\S1(\"name\");") : new Test_S1("name"); + $v1->s = $NS ? eval("return new Test\\S1(\"name\");") : new Test_S1("name"); test($v1 == $def_s2); $v1 = clone $def_s2; - $v1->s = $NS ? eval("new Test\\S1(\"noname\");") : new Test_S1("noname"); + $v1->s = $NS ? eval("return new Test\\S1(\"noname\");") : new Test_S1("noname"); test($v1 != $def_s2); $v1 = clone $def_s2; |