diff options
Diffstat (limited to 'php/test')
140 files changed, 1259 insertions, 1622 deletions
diff --git a/php/test/Ice/Makefile b/php/test/Ice/Makefile deleted file mode 100644 index f371648e021..00000000000 --- a/php/test/Ice/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../.. - -include $(top_srcdir)/config/Make.rules.php - -SUBDIRS = binding checksum exceptions facets info inheritance objects operations proxy slicing defaultValue \ - optional enums acm - -$(EVERYTHING):: - @for subdir in $(SUBDIRS); \ - do \ - echo "making $@ in $$subdir"; \ - ( cd $$subdir && $(MAKE) $@ ) || exit 1; \ - done diff --git a/php/test/Ice/Makefile.mak b/php/test/Ice/Makefile.mak deleted file mode 100644 index f4dcd96a7a8..00000000000 --- a/php/test/Ice/Makefile.mak +++ /dev/null @@ -1,20 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\.. - -!include $(top_srcdir)\config\Make.rules.mak.php - -SUBDIRS = binding checksum exceptions facets info inheritance objects operations proxy slicing defaultValue \ - optional enums acm - -$(EVERYTHING):: - @for %i in ( $(SUBDIRS) ) do \ - @echo "making $@ in %i" && \ - cmd /c "cd %i && $(MAKE) -nologo -f Makefile.mak $@" || exit 1 diff --git a/php/test/Ice/acm/.depend.mak b/php/test/Ice/acm/.depend.mak deleted file mode 100644 index 4eba865be84..00000000000 --- a/php/test/Ice/acm/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Test.php: \ - Test.ice diff --git a/php/test/Ice/acm/Client.php b/php/test/Ice/acm/Client.php index 217a1f0513b..297e3f87262 100644 --- a/php/test/Ice/acm/Client.php +++ b/php/test/Ice/acm/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); function test($b) { @@ -30,16 +30,13 @@ function test($b) } } -function allTests($communicator) +function testSetACM($communicator, $com) { global $NS; echo "testing setACM/getACM... "; flush(); - $ref = "communicator:default -p 12010"; - $com = $communicator->stringToProxy($ref)->ice_uncheckedCast("::Test::RemoteCommunicator"); - $adapter = $com->createObjectAdapter(-1, -1, -1); $initData = $NS ? eval("return new Ice\\InitializationData;") : new Ice_InitializationData; @@ -48,7 +45,11 @@ function allTests($communicator) $initData->properties->setProperty("Ice.ACM.Client.Timeout", "15"); $initData->properties->setProperty("Ice.ACM.Client.Close", "4"); $initData->properties->setProperty("Ice.ACM.Client.Heartbeat", "2"); - $testCommunicator = $NS ? eval("return Ice\\initialize(\$initData);") : Ice_initialize($initData); + + $testCommunicator = $NS ? eval("return Ice\\initialize(\$initData);") : + eval("return Ice_initialize(\$initData);"); + + $proxy = $testCommunicator->stringToProxy($adapter->getTestIntf()->ice_toString())->ice_uncheckedCast( "::Test::TestIntf"); $proxy->ice_getConnection(); @@ -79,19 +80,60 @@ function allTests($communicator) test($acm->close == $CloseOnInvocationAndIdle); test($acm->heartbeat == $HeartbeatAlways); - $proxy->waitForHeartbeat(2); + $proxy->startHeartbeatCount(); + $proxy->waitForHeartbeatCount(2); $adapter->deactivate(); $testCommunicator->destroy(); echo "ok\n"; +} - echo "shutting down... "; +function testHeartbeatManual($communicator, $com) +{ + global $NS; + + echo "testing manual heartbeats... "; flush(); - $com->shutdown(); + + $adapter = $com->createObjectAdapter(10, -1, 0); + + $initData = $NS ? eval("return new Ice\\InitializationData;") : new Ice_InitializationData; + $initData->properties = $communicator->getProperties()->clone(); + $initData->properties->setProperty("Ice.ACM.Timeout", "10"); + $initData->properties->setProperty("Ice.ACM.Client.Timeout", "10"); + $initData->properties->setProperty("Ice.ACM.Client.Close", "0"); + $initData->properties->setProperty("Ice.ACM.Client.Heartbeat", "0"); + $testCommunicator = $NS ? eval("return Ice\\initialize(\$initData);") : Ice_initialize($initData); + $proxy = $testCommunicator->stringToProxy($adapter->getTestIntf()->ice_toString())->ice_uncheckedCast( + "::Test::TestIntf"); + $con = $proxy->ice_getConnection(); + + $proxy->startHeartbeatCount(); + $con->heartbeat(); + $con->heartbeat(); + $con->heartbeat(); + $con->heartbeat(); + $con->heartbeat(); + $proxy->waitForHeartbeatCount(5); + + $adapter->deactivate(); + $testCommunicator->destroy(); echo "ok\n"; } -$communicator = Ice_initialize($argv); +function allTests($communicator) +{ + $ref = "communicator:default -p 12010"; + $com = $communicator->stringToProxy($ref)->ice_uncheckedCast("::Test::RemoteCommunicator"); + + testSetACM($communicator, $com); + testHeartbeatManual($communicator, $com); + + $com->shutdown(); +} + +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); allTests($communicator); $communicator->destroy(); diff --git a/php/test/Ice/acm/Makefile b/php/test/Ice/acm/Makefile deleted file mode 100644 index de41e9ce180..00000000000 --- a/php/test/Ice/acm/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/acm/Makefile.mak b/php/test/Ice/acm/Makefile.mak deleted file mode 100644 index 4ece14f179d..00000000000 --- a/php/test/Ice/acm/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/acm/Test.ice b/php/test/Ice/acm/Test.ice index cd9867f820e..7018c9df821 100644 --- a/php/test/Ice/acm/Test.ice +++ b/php/test/Ice/acm/Test.ice @@ -17,7 +17,8 @@ interface TestIntf void sleep(int seconds); void sleepAndHold(int seconds); void interruptSleep(); - void waitForHeartbeat(int count); + void startHeartbeatCount(); + void waitForHeartbeatCount(int count); }; interface RemoteObjectAdapter diff --git a/php/test/Ice/acm/msbuild/test.proj b/php/test/Ice/acm/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Ice/acm/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/acm/run.py b/php/test/Ice/acm/run.py deleted file mode 100755 index 1a8297794cd..00000000000 --- a/php/test/Ice/acm/run.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -TestUtil.clientServerTest() diff --git a/php/test/Ice/binding/.depend.mak b/php/test/Ice/binding/.depend.mak deleted file mode 100644 index 4eba865be84..00000000000 --- a/php/test/Ice/binding/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Test.php: \ - Test.ice diff --git a/php/test/Ice/binding/Client.php b/php/test/Ice/binding/Client.php index 7b7ac2ea318..86ca389d354 100644 --- a/php/test/Ice/binding/Client.php +++ b/php/test/Ice/binding/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); function test($b) { @@ -61,6 +61,9 @@ function allTests($communicator) $random = $NS ? constant("Ice\\EndpointSelectionType::Random") : constant("Ice_EndpointSelectionType::Random"); $ordered = $NS ? constant("Ice\\EndpointSelectionType::Ordered") : constant("Ice_EndpointSelectionType::Ordered"); + $closeGracefullyAndWait = + $NS ? constant("Ice\\ConnectionClose::GracefullyWithWait") : + constant("Ice_ConnectionClose::GracefullyWithWait"); $ref = "communicator:default -p 12010"; $com = $communicator->stringToProxy($ref)->ice_uncheckedCast("::Test::RemoteCommunicator"); @@ -91,7 +94,8 @@ function allTests($communicator) catch(Exception $ex) { $cre = $NS ? "Ice\\ConnectionRefusedException" : "Ice_ConnectionRefusedException"; - if(!($ex instanceof $cre)) + $cte = $NS ? "Ice\\ConnectTimeoutException" : "Ice_ConnectTimeoutException"; + if(!($ex instanceof $cre) && !($ex instanceof $cte)) { throw $ex; } @@ -130,7 +134,7 @@ function allTests($communicator) { unset($names[$key]); } - $test1->ice_getConnection()->close(false); + $test1->ice_getConnection()->close($closeGracefullyAndWait); } // @@ -151,7 +155,7 @@ function allTests($communicator) foreach($adapters as $p) { - $p->getTestIntf()->ice_getConnection()->close(false); + $p->getTestIntf()->ice_getConnection()->close($closeGracefullyAndWait); } } @@ -179,7 +183,7 @@ function allTests($communicator) { unset($names[$key]); } - $test1->ice_getConnection()->close(false); + $test1->ice_getConnection()->close($closeGracefullyAndWait); } // @@ -213,7 +217,7 @@ function allTests($communicator) { unset($names[$key]); } - $test->ice_getConnection()->close(false); + $test->ice_getConnection()->close($closeGracefullyAndWait); } $test = $test->ice_endpointSelection($random)->ice_uncheckedCast("::Test::TestIntf"); @@ -227,7 +231,7 @@ function allTests($communicator) { unset($names[$key]); } - $test->ice_getConnection()->close(false); + $test->ice_getConnection()->close($closeGracefullyAndWait); } deactivate($com, $adapters); @@ -268,7 +272,8 @@ function allTests($communicator) catch(Exception $ex) { $cre = $NS ? "Ice\\ConnectionRefusedException" : "Ice_ConnectionRefusedException"; - if(!($ex instanceof $cre)) + $cte = $NS ? "Ice\\ConnectTimeoutException" : "Ice_ConnectTimeoutException"; + if(!($ex instanceof $cre) && !($ex instanceof $cte)) { throw $ex; } @@ -285,11 +290,11 @@ function allTests($communicator) $adapters[] = $com->createObjectAdapter("Adapter36", $endpoints[2]->toString()); for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter36"; $i++); test($i == $nRetry); - $test->ice_getConnection()->close(false); + $test->ice_getConnection()->close($closeGracefullyAndWait); $adapters[] = $com->createObjectAdapter("Adapter35", $endpoints[1]->toString()); for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter35"; $i++); test($i == $nRetry); - $test->ice_getConnection()->close(false); + $test->ice_getConnection()->close($closeGracefullyAndWait); $adapters[] = $com->createObjectAdapter("Adapter34", $endpoints[0]->toString()); for($i = 0; $i < $nRetry && $test->getAdapterName() == "Adapter34"; $i++); test($i == $nRetry); @@ -322,7 +327,8 @@ function allTests($communicator) catch(Exception $ex) { $cre = $NS ? "Ice\\ConnectionRefusedException" : "Ice_ConnectionRefusedException"; - if(!($ex instanceof $cre)) + $cte = $NS ? "Ice\\ConnectTimeoutException" : "Ice_ConnectTimeoutException"; + if(!($ex instanceof $cre) && !($ex instanceof $cte)) { throw $ex; } @@ -407,7 +413,8 @@ function allTests($communicator) catch(Exception $ex) { $cre = $NS ? "Ice\\ConnectionRefusedException" : "Ice_ConnectionRefusedException"; - if(!($ex instanceof $cre)) + $cte = $NS ? "Ice\\ConnectTimeoutException" : "Ice_ConnectTimeoutException"; + if(!($ex instanceof $cre) && !($ex instanceof $cte)) { throw $ex; } @@ -475,7 +482,7 @@ function allTests($communicator) for($i = 0; $i < 5; $i++) { test($test->getAdapterName() == "Adapter82"); - $test->ice_getConnection()->close(false); + $test->ice_getConnection()->close($closeGracefullyAndWait); } $testSecure = $test->ice_secure(true)->ice_uncheckedCast("::Test::TestIntf"); @@ -491,7 +498,7 @@ function allTests($communicator) for($i = 0; $i < 5; $i++) { test($test->getAdapterName() == "Adapter81"); - $test->ice_getConnection()->close(false); + $test->ice_getConnection()->close($closeGracefullyAndWait); } $endpts = $test->ice_getEndpoints(); @@ -500,7 +507,7 @@ function allTests($communicator) for($i = 0; $i < 5; $i++) { test($test->getAdapterName() == "Adapter83"); - $test->ice_getConnection()->close(false); + $test->ice_getConnection()->close($closeGracefullyAndWait); } $com->deactivateObjectAdapter($adapters[0]); @@ -512,7 +519,8 @@ function allTests($communicator) catch(Exception $ex) { $cre = $NS ? "Ice\\ConnectionRefusedException" : "Ice_ConnectionRefusedException"; - if(!($ex instanceof $cre)) + $cte = $NS ? "Ice\\ConnectTimeoutException" : "Ice_ConnectTimeoutException"; + if(!($ex instanceof $cre) && !($ex instanceof $cte)) { throw $ex; } @@ -526,7 +534,9 @@ function allTests($communicator) $com->shutdown(); } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); + allTests($communicator); $communicator->destroy(); exit(); diff --git a/php/test/Ice/binding/Makefile b/php/test/Ice/binding/Makefile deleted file mode 100644 index 495ae0dc091..00000000000 --- a/php/test/Ice/binding/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = Test.ice - -SLICE2PHPFLAGS = --checksum - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/binding/Makefile.mak b/php/test/Ice/binding/Makefile.mak deleted file mode 100644 index 4ece14f179d..00000000000 --- a/php/test/Ice/binding/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/binding/msbuild/test.proj b/php/test/Ice/binding/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Ice/binding/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/binding/run.py b/php/test/Ice/binding/run.py deleted file mode 100755 index 1a8297794cd..00000000000 --- a/php/test/Ice/binding/run.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -TestUtil.clientServerTest() diff --git a/php/test/Ice/checksum/.depend.mak b/php/test/Ice/checksum/.depend.mak deleted file mode 100644 index 7e215103737..00000000000 --- a/php/test/Ice/checksum/.depend.mak +++ /dev/null @@ -1,7 +0,0 @@ - -Test.php: \ - Test.ice \ - "$(slicedir)/Ice/SliceChecksumDict.ice" - -CTypes.php: \ - CTypes.ice diff --git a/php/test/Ice/checksum/CTypes.ice b/php/test/Ice/checksum/CTypes.ice index f4d3198b613..90d57195d43 100644 --- a/php/test/Ice/checksum/CTypes.ice +++ b/php/test/Ice/checksum/CTypes.ice @@ -378,7 +378,7 @@ exception OptionalEx4 // // TEST: Same // -class BaseClass1 +interface BaseInterface1 { void baseOp1(); void baseOp2(int i, out string s) throws Exception1; @@ -387,7 +387,7 @@ class BaseClass1 // // TEST: Change return type // -class BaseClass2 +interface BaseInterface2 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; @@ -396,7 +396,7 @@ class BaseClass2 // // TEST: Add parameter // -class BaseClass3 +interface BaseInterface3 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; @@ -405,7 +405,7 @@ class BaseClass3 // // TEST: Add exception // -class BaseClass4 +interface BaseInterface4 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; @@ -414,7 +414,7 @@ class BaseClass4 // // TEST: Change out parameter to in parameter // -class BaseClass5 +interface BaseInterface5 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; @@ -423,7 +423,7 @@ class BaseClass5 // // TEST: Remove parameter // -class BaseClass6 +interface BaseInterface6 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; @@ -432,7 +432,7 @@ class BaseClass6 // // TEST: Remove exception // -class BaseClass7 +interface BaseInterface7 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; @@ -441,7 +441,7 @@ class BaseClass7 // // TEST: Remove operation // -class BaseClass8 +interface BaseInterface8 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; @@ -450,7 +450,7 @@ class BaseClass8 // // TEST: Add base class // -class BaseClass9 +interface BaseInterface9 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; @@ -459,7 +459,7 @@ class BaseClass9 // // TEST: Add interface // -class BaseClass10 +interface BaseInterface10 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; @@ -468,7 +468,7 @@ class BaseClass10 // // TEST: Add base class and interface // -class BaseClass11 +interface BaseInterface11 { void baseOp(); void baseOp2(int i, out string s) throws Exception1; @@ -479,8 +479,7 @@ class BaseClass11 // class Compact1(1) { - void baseOp(); - void baseOp2(int i, out string s) throws Exception1; + int id; }; // @@ -495,8 +494,7 @@ class Derived1 extends Compact1 // class Compact2(2) { - void baseOp(); - void baseOp2(int i, out string s) throws Exception1; + int id; }; // @@ -550,53 +548,53 @@ class Optional4 }; // -// TEST: Class with optional parameters. +// TEST: Interface with optional parameters. // -class OptionalParameters0 +interface OptionalParameters0 { void op1(string firstName, optional(1) string secondName, optional(2) string emailAddress); }; // -// TEST: Class with optional parameters, different order. +// TEST: Interface with optional parameters, different order. // -class OptionalParameters1 +interface OptionalParameters1 { void op1(string firstName, optional(1) string secondName, optional(2) string emailAddress); }; // -// TEST: Class with optional parameters, different tags. +// TEST: Interface with optional parameters, different tags. // -class OptionalParameters2 +interface OptionalParameters2 { void op1(string firstName, optional(1) string emailAddress, optional(2) string secondName); }; // -// TEST: Class with different optional parameters. +// TEST: Interface with different optional parameters. // -class OptionalParameters3 +interface OptionalParameters3 { void op1(string firstName, optional(1) string emailAddress, string secondName); }; // -// TEST: Class with optional return type. +// TEST: Interface with optional return type. // -class OptionalReturn0 +interface OptionalReturn0 { optional(1) int op(); }; // -// TEST: Class that changes optional return type. +// TEST: Interface that changes optional return type. // -class OptionalReturn2 +interface OptionalReturn2 { optional(1) int op(); }; diff --git a/php/test/Ice/checksum/Client.php b/php/test/Ice/checksum/Client.php index a380f6c8633..367c19c21e8 100644 --- a/php/test/Ice/checksum/Client.php +++ b/php/test/Ice/checksum/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,9 +17,9 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; -require_once 'CTypes.php'; +require_once('Ice.php'); +require_once('Test.php'); +require_once('CTypes.php'); function test($b) { @@ -89,7 +89,9 @@ function allTests($communicator) return $checksum; } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); + $checksum = allTests($communicator); $checksum->shutdown(); $communicator->destroy(); diff --git a/php/test/Ice/checksum/Makefile b/php/test/Ice/checksum/Makefile deleted file mode 100644 index 62c54700383..00000000000 --- a/php/test/Ice/checksum/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE2PHPFLAGS = --checksum - -SLICE_SRCS = Test.ice \ - CTypes.ice - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/checksum/Makefile.mak b/php/test/Ice/checksum/Makefile.mak deleted file mode 100644 index b37ba637a5b..00000000000 --- a/php/test/Ice/checksum/Makefile.mak +++ /dev/null @@ -1,16 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE2PHPFLAGS = --checksum - -SLICE_SRCS = Test.ice CTypes.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/enums/Makefile b/php/test/Ice/checksum/Makefile.mk index de41e9ce180..1ad8ec3cd83 100644 --- a/php/test/Ice/enums/Makefile +++ b/php/test/Ice/checksum/Makefile.mk @@ -1,14 +1,12 @@ # ********************************************************************** # -# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. +# Copyright (c) 2003-2016 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. # # ********************************************************************** -top_srcdir = ../../.. +$(test)_sliceflags = --checksum -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php +tests += $(test) diff --git a/php/test/Ice/checksum/msbuild/test.proj b/php/test/Ice/checksum/msbuild/test.proj new file mode 100644 index 00000000000..8d77eb322b8 --- /dev/null +++ b/php/test/Ice/checksum/msbuild/test.proj @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <PropertyGroup> + <IceBuilderChecksum>true</IceBuilderChecksum> + </PropertyGroup> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/checksum/run.py b/php/test/Ice/checksum/run.py deleted file mode 100755 index f491eb437e3..00000000000 --- a/php/test/Ice/checksum/run.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -TestUtil.clientServerTest(server='server/server') diff --git a/php/test/Ice/defaultValue/.depend.mak b/php/test/Ice/defaultValue/.depend.mak deleted file mode 100644 index 4eba865be84..00000000000 --- a/php/test/Ice/defaultValue/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Test.php: \ - Test.ice diff --git a/php/test/Ice/defaultValue/Client.php b/php/test/Ice/defaultValue/Client.php index fd74b77868a..2c0724e642b 100644 --- a/php/test/Ice/defaultValue/Client.php +++ b/php/test/Ice/defaultValue/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); function test($b) { diff --git a/php/test/Ice/defaultValue/Makefile.mak b/php/test/Ice/defaultValue/Makefile.mak deleted file mode 100644 index 4ece14f179d..00000000000 --- a/php/test/Ice/defaultValue/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/defaultValue/Test.ice b/php/test/Ice/defaultValue/Test.ice index 4520c799c19..d1bf947804a 100644 --- a/php/test/Ice/defaultValue/Test.ice +++ b/php/test/Ice/defaultValue/Test.ice @@ -9,6 +9,8 @@ #pragma once +[["suppress-warning:deprecated"]] // For enumerator references + module Test { @@ -32,12 +34,12 @@ struct Struct1 float f = 5.1; double d = 6.2; string str = "foo \\ \"bar\n \r\n\t\013\f\007\b? \007 \007"; - Color c1 = ::Test::red; + Color c1 = ::Test::Color::red; Color c2 = Test::green; Color c3 = blue; - Nested::Color nc1 = ::Test::Nested::red; + Nested::Color nc1 = Test::Nested::Color::red; Nested::Color nc2 = Nested::green; - Nested::Color nc3 = Nested::blue; + Nested::Color nc3 = blue; string noDefault; int zeroI = 0; long zeroL = 0; @@ -55,12 +57,12 @@ const long ConstLong = 4; const float ConstFloat = 5.1; const double ConstDouble = 6.2; const string ConstString = "foo \\ \"bar\n \r\n\t\013\f\007\b? \007 \007"; -const Color ConstColor1 = ::Test::red; +const Color ConstColor1 = ::Test::Color::red; const Color ConstColor2 = Test::green; const Color ConstColor3 = blue; -const Nested::Color ConstNestedColor1 = ::Test::Nested::red; +const Nested::Color ConstNestedColor1 = Test::Nested::Color::red; const Nested::Color ConstNestedColor2 = Test::Nested::green; -const Nested::Color ConstNestedColor3 = Nested::blue; +const Nested::Color ConstNestedColor3 = blue; const int ConstZeroI = 0; const long ConstZeroL = 0; const float ConstZeroF = 0; @@ -114,12 +116,12 @@ class Base class Derived extends Base { - Color c1 = ::Test::red; + Color c1 = ::Test::Color::red; Color c2 = Test::green; Color c3 = blue; - Nested::Color nc1 = ::Test::Nested::red; + Nested::Color nc1 = ::Test::Nested::Color::red; Nested::Color nc2 = Nested::green; - Nested::Color nc3 = Nested::blue; + Nested::Color nc3 = blue; }; exception BaseEx diff --git a/php/test/Ice/defaultValue/msbuild/test.proj b/php/test/Ice/defaultValue/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Ice/defaultValue/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/defaultValue/run.py b/php/test/Ice/defaultValue/run.py deleted file mode 100755 index c171a3556ce..00000000000 --- a/php/test/Ice/defaultValue/run.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -testdir = os.getcwd() - -client = os.path.join(testdir, "Client.php") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/php/test/Ice/enums/.depend.mak b/php/test/Ice/enums/.depend.mak deleted file mode 100644 index 4eba865be84..00000000000 --- a/php/test/Ice/enums/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Test.php: \ - Test.ice diff --git a/php/test/Ice/enums/Client.php b/php/test/Ice/enums/Client.php index 2370fc0ed08..9a687a8802a 100644 --- a/php/test/Ice/enums/Client.php +++ b/php/test/Ice/enums/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); function test($b) { @@ -246,7 +246,9 @@ function allTests($communicator) return $proxy; } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); + $t = allTests($communicator); $t->shutdown(); $communicator->destroy(); diff --git a/php/test/Ice/enums/Makefile.mak b/php/test/Ice/enums/Makefile.mak deleted file mode 100644 index 4ece14f179d..00000000000 --- a/php/test/Ice/enums/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/enums/msbuild/test.proj b/php/test/Ice/enums/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Ice/enums/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/enums/run.py b/php/test/Ice/enums/run.py deleted file mode 100755 index 651b1b334b6..00000000000 --- a/php/test/Ice/enums/run.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -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 1.1 encoding.") -TestUtil.clientServerTest() diff --git a/php/test/Ice/exceptions/.depend.mak b/php/test/Ice/exceptions/.depend.mak deleted file mode 100644 index c873b711b47..00000000000 --- a/php/test/Ice/exceptions/.depend.mak +++ /dev/null @@ -1,4 +0,0 @@ - -Test.php: \ - Test.ice \ - "$(slicedir)/Ice/BuiltinSequences.ice" diff --git a/php/test/Ice/exceptions/Client.php b/php/test/Ice/exceptions/Client.php index 8784f1ee4af..430c985a125 100644 --- a/php/test/Ice/exceptions/Client.php +++ b/php/test/Ice/exceptions/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -9,8 +9,8 @@ // ********************************************************************** $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); error_reporting(E_ALL | E_STRICT); @@ -309,7 +309,8 @@ function allTests($communicator) echo "catching object not exist exception... "; flush(); - $id = $communicator->stringToIdentity("does not exist"); + $stringToIdentity = $NS ? "Ice\\stringToIdentity" : "Ice_stringToIdentity"; + $id = $stringToIdentity("does not exist"); try { $thrower2 = $thrower->ice_identity($id)->ice_uncheckedCast("::Test::Thrower"); @@ -429,9 +430,10 @@ function allTests($communicator) } $initData = $NS ? eval("return new Ice\\InitializationData;") : eval("return new Ice_InitializationData;"); -$initData->properties = Ice_getProperties(); +$initData->properties = $NS ? eval("return Ice\\getProperties();") : eval("return Ice_getProperties();"); $initData->properties->setProperty("Ice.MessageSizeMax", "10"); -$communicator = Ice_initialize($argv, $initData); +$communicator = $NS ? eval("return Ice\\initialize(\$argv, \$initData);") : + eval("return Ice_initialize(\$argv, \$initData);"); // This property is set by the test suite, howerver we need to override it for this test. // Unlike C++, we can not pass $argv into Ice::createProperties, so we just set it after. diff --git a/php/test/Ice/exceptions/Makefile b/php/test/Ice/exceptions/Makefile deleted file mode 100644 index de41e9ce180..00000000000 --- a/php/test/Ice/exceptions/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/exceptions/Makefile.mak b/php/test/Ice/exceptions/Makefile.mak deleted file mode 100644 index 4ece14f179d..00000000000 --- a/php/test/Ice/exceptions/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/exceptions/msbuild/test.proj b/php/test/Ice/exceptions/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Ice/exceptions/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/exceptions/run.py b/php/test/Ice/exceptions/run.py deleted file mode 100755 index 09043b1264f..00000000000 --- a/php/test/Ice/exceptions/run.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -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") - -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/facets/.depend.mak b/php/test/Ice/facets/.depend.mak deleted file mode 100644 index 4eba865be84..00000000000 --- a/php/test/Ice/facets/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Test.php: \ - Test.ice diff --git a/php/test/Ice/facets/Client.php b/php/test/Ice/facets/Client.php index 7c72e6d7730..b4bcd335fe4 100644 --- a/php/test/Ice/facets/Client.php +++ b/php/test/Ice/facets/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); function test($b) { @@ -128,7 +128,8 @@ function allTests($communicator) return $gf; } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); $g = allTests($communicator); $g->shutdown(); $communicator->destroy(); diff --git a/php/test/Ice/facets/Makefile b/php/test/Ice/facets/Makefile deleted file mode 100644 index de41e9ce180..00000000000 --- a/php/test/Ice/facets/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/facets/Makefile.mak b/php/test/Ice/facets/Makefile.mak deleted file mode 100644 index 4ece14f179d..00000000000 --- a/php/test/Ice/facets/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/facets/msbuild/test.proj b/php/test/Ice/facets/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Ice/facets/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/facets/run.py b/php/test/Ice/facets/run.py deleted file mode 100755 index 1a8297794cd..00000000000 --- a/php/test/Ice/facets/run.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -TestUtil.clientServerTest() diff --git a/php/test/Ice/info/.depend.mak b/php/test/Ice/info/.depend.mak deleted file mode 100644 index 877972badb0..00000000000 --- a/php/test/Ice/info/.depend.mak +++ /dev/null @@ -1,8 +0,0 @@ - -Test.php: \ - Test.ice \ - "$(slicedir)/Ice/Current.ice" \ - "$(slicedir)/Ice/ObjectAdapterF.ice" \ - "$(slicedir)/Ice/ConnectionF.ice" \ - "$(slicedir)/Ice/Identity.ice" \ - "$(slicedir)/Ice/Version.ice" diff --git a/php/test/Ice/info/Client.php b/php/test/Ice/info/Client.php index fc440cd7d5f..747a1675999 100644 --- a/php/test/Ice/info/Client.php +++ b/php/test/Ice/info/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); function test($b) { @@ -30,11 +30,38 @@ function test($b) } } +function getTCPEndpointInfo($i) +{ + global $NS; + $tcpEndpointInfoClass = $NS ? "Ice\\TCPEndpointInfo" : "Ice_TCPEndpointInfo"; + while($i) + { + if($i instanceof $tcpEndpointInfoClass) + { + return $i; + } + $i = $i->underlying; + } +} + +function getTCPConnectionInfo($i) +{ + global $NS; + $ipConnectionInfoClass = $NS ? "Ice\\TCPConnectionInfo" : "Ice_TCPConnectionInfo"; + while($i) + { + if($i instanceof $ipConnectionInfoClass) + { + return $i; + } + $i = $i->underlying; + } +} + function allTests($communicator) { global $NS; - $ipEndpointInfoClass = $NS ? "Ice\\IPEndpointInfo" : "Ice_IPEndpointInfo"; $tcpEndpointType = $NS ? constant("Ice\\TCPEndpointType") : constant("Ice_TCPEndpointType"); $tcpEndpointInfoClass = $NS ? "Ice\\TCPEndpointInfo" : "Ice_TCPEndpointInfo"; $udpEndpointType = $NS ? constant("Ice\\UDPEndpointType") : constant("Ice_UDPEndpointType"); @@ -58,22 +85,23 @@ function allTests($communicator) $endps = $p1->ice_getEndpoints(); - $ipEndpoint = $endps[0]->getInfo(); - test($ipEndpoint instanceof $ipEndpointInfoClass); - test($ipEndpoint->host == "tcphost"); - test($ipEndpoint->port == 10000); - test($ipEndpoint->timeout == 1200); - test($ipEndpoint->sourceAddress == "10.10.10.10"); - test($ipEndpoint->compress); - test(!$ipEndpoint->datagram()); - test(($ipEndpoint->type() == $tcpEndpointType && !$ipEndpoint->secure()) || - ($ipEndpoint->type() == $sslEndpointType && $ipEndpoint->secure()) || - ($ipEndpoint->type() == $wsEndpointType && !$ipEndpoint->secure()) || - ($ipEndpoint->type() == $wssEndpointType && $ipEndpoint->secure())); - test(($ipEndpoint->type() == $tcpEndpointType && ($ipEndpoint instanceof $tcpEndpointInfoClass)) || - ($ipEndpoint->type() == $sslEndpointType && ($ipEndpoint instanceof $sslEndpointInfoClass)) || - ($ipEndpoint->type() == $wsEndpointType && ($ipEndpoint instanceof $wsEndpointInfoClass)) || - ($ipEndpoint->type() == $wssEndpointType && ($ipEndpoint instanceof $wssEndpointInfoClass))); + $endpoint = $endps[0]->getInfo(); + $tcpEndpoint = getTCPEndpointInfo($endpoint); + test($tcpEndpoint instanceof $tcpEndpointInfoClass); + test($tcpEndpoint->host == "tcphost"); + test($tcpEndpoint->port == 10000); + test($tcpEndpoint->timeout == 1200); + test($tcpEndpoint->sourceAddress == "10.10.10.10"); + test($tcpEndpoint->compress); + test(!$tcpEndpoint->datagram()); + test(($tcpEndpoint->type() == $tcpEndpointType && !$tcpEndpoint->secure()) || + ($tcpEndpoint->type() == $sslEndpointType && $tcpEndpoint->secure()) || + ($tcpEndpoint->type() == $wsEndpointType && !$tcpEndpoint->secure()) || + ($tcpEndpoint->type() == $wssEndpointType && $tcpEndpoint->secure())); + test(($tcpEndpoint->type() == $tcpEndpointType && ($endpoint instanceof $tcpEndpointInfoClass)) || + ($tcpEndpoint->type() == $sslEndpointType && ($endpoint instanceof $sslEndpointInfoClass)) || + ($tcpEndpoint->type() == $wsEndpointType && ($endpoint instanceof $wsEndpointInfoClass)) || + ($tcpEndpoint->type() == $wssEndpointType && ($endpoint instanceof $wsEndpointInfoClass))); $udpEndpoint = $endps[1]->getInfo(); test($udpEndpoint instanceof $udpEndpointInfoClass); @@ -100,14 +128,14 @@ function allTests($communicator) echo "test connection endpoint information... "; flush(); { - $ipinfo = $base->ice_getConnection()->getEndpoint()->getInfo(); - test($ipinfo instanceof $ipEndpointInfoClass); - test($ipinfo->port == 12010); - test(!$ipinfo->compress); - test($ipinfo->host == $defaultHost); + $tcpinfo = getTCPEndpointInfo($base->ice_getConnection()->getEndpoint()->getInfo()); + test($tcpinfo instanceof $tcpEndpointInfoClass); + test($tcpinfo->port == 12010); + test(!$tcpinfo->compress); + test($tcpinfo->host == $defaultHost); $ctx = $testIntf->getEndpointInfoAsContext(); - test($ctx["host"] == $ipinfo->host); + test($ctx["host"] == $tcpinfo->host); test($ctx["compress"] == "false"); test($ctx["port"] > 0); @@ -121,38 +149,37 @@ function allTests($communicator) echo "testing connection information... "; flush(); { - $ipConnectionInfoClass = $NS ? "Ice\\IPConnectionInfo" : "Ice_IPConnectionInfo"; + $ipConnectionInfoClass = $NS ? "Ice\\TCPConnectionInfo" : "Ice_TCPConnectionInfo"; $wsConnectionInfoClass = $NS ? "Ice\\WSConnectionInfo" : "Ice_WSConnectionInfo"; - $wssConnectionInfoClass = $NS ? "Ice\\WSSConnectionInfo" : "Ice_WSSConnectionInfo"; $connection = $base->ice_getConnection(); $connection->setBufferSize(1024, 2048); $info = $connection->getInfo(); - test($info instanceof $ipConnectionInfoClass); + $tcpinfo = getTCPConnectionInfo($info); + test($tcpinfo instanceof $ipConnectionInfoClass); test(!$info->incoming); test(strlen($info->adapterName) == 0); - test($info->remotePort == 12010); + test($tcpinfo->remotePort == 12010); if($defaultHost == "127.0.0.1") { - test($info->remoteAddress == $defaultHost); - test($info->localAddress == $defaultHost); + test($tcpinfo->remoteAddress == $defaultHost); + test($tcpinfo->localAddress == $defaultHost); } - test($info->rcvSize >= 1024); - test($info->sndSize >= 2048); + test($tcpinfo->rcvSize >= 1024); + test($tcpinfo->sndSize >= 2048); $ctx = $testIntf->getConnectionInfoAsContext(); test($ctx["incoming"] == "true"); test($ctx["adapterName"] == "TestAdapter"); - test($ctx["remoteAddress"] == $info->localAddress); - test($ctx["localAddress"] == $info->remoteAddress); - test($ctx["remotePort"] == $info->localPort); - test($ctx["localPort"] == $info->remotePort); + test($ctx["remoteAddress"] == $tcpinfo->localAddress); + test($ctx["localAddress"] == $tcpinfo->remoteAddress); + test($ctx["remotePort"] == $tcpinfo->localPort); + test($ctx["localPort"] == $tcpinfo->remotePort); if($base->ice_getConnection()->type() == "ws" || $base->ice_getConnection()->type() == "wss") { - test(($base->ice_getConnection()->type() == "ws" && $info instanceof $wsConnectionInfoClass) || - ($base->ice_getConnection()->type() == "wss" && $info instanceof $wssConnectionInfoClass)); + test($info instanceof $wsConnectionInfoClass); test($info->headers["Upgrade"] == "websocket"); test($info->headers["Connection"] == "Upgrade"); @@ -171,7 +198,8 @@ function allTests($communicator) return $testIntf; } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); $server = allTests($communicator); $server->shutdown(); $communicator->destroy(); diff --git a/php/test/Ice/info/Makefile b/php/test/Ice/info/Makefile deleted file mode 100644 index de41e9ce180..00000000000 --- a/php/test/Ice/info/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/info/Makefile.mak b/php/test/Ice/info/Makefile.mak deleted file mode 100644 index 4ece14f179d..00000000000 --- a/php/test/Ice/info/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/info/msbuild/test.proj b/php/test/Ice/info/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Ice/info/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/info/run.py b/php/test/Ice/info/run.py deleted file mode 100755 index 1a8297794cd..00000000000 --- a/php/test/Ice/info/run.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -TestUtil.clientServerTest() diff --git a/php/test/Ice/inheritance/.depend.mak b/php/test/Ice/inheritance/.depend.mak deleted file mode 100644 index 4eba865be84..00000000000 --- a/php/test/Ice/inheritance/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Test.php: \ - Test.ice diff --git a/php/test/Ice/inheritance/Client.php b/php/test/Ice/inheritance/Client.php index cf0355c2baa..b1d03811431 100644 --- a/php/test/Ice/inheritance/Client.php +++ b/php/test/Ice/inheritance/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); function test($b) { @@ -237,7 +237,8 @@ function allTests($communicator) return $initial; } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); $initial = allTests($communicator); $initial->shutdown(); $communicator->destroy(); diff --git a/php/test/Ice/inheritance/Makefile b/php/test/Ice/inheritance/Makefile deleted file mode 100644 index de41e9ce180..00000000000 --- a/php/test/Ice/inheritance/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/inheritance/Makefile.mak b/php/test/Ice/inheritance/Makefile.mak deleted file mode 100644 index 4ece14f179d..00000000000 --- a/php/test/Ice/inheritance/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/inheritance/Test.ice b/php/test/Ice/inheritance/Test.ice index 84af3da3fd6..372dbcc414a 100644 --- a/php/test/Ice/inheritance/Test.ice +++ b/php/test/Ice/inheritance/Test.ice @@ -9,6 +9,8 @@ #pragma once +[["suppress-warning:deprecated"]] // For classes with operations + module Test { diff --git a/php/test/Ice/inheritance/msbuild/test.proj b/php/test/Ice/inheritance/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Ice/inheritance/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/inheritance/run.py b/php/test/Ice/inheritance/run.py deleted file mode 100755 index 1a8297794cd..00000000000 --- a/php/test/Ice/inheritance/run.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -TestUtil.clientServerTest() diff --git a/php/test/Ice/ini/Client.php b/php/test/Ice/ini/Client.php index 14b9f19ac5e..1cd9f8c4dfe 100644 --- a/php/test/Ice/ini/Client.php +++ b/php/test/Ice/ini/Client.php @@ -27,7 +27,7 @@ function test($b) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); +require_once('Ice.php'); $communicator = null; diff --git a/php/test/Ice/ini/ClientWithProfile.php b/php/test/Ice/ini/ClientWithProfile.php index cc23a5fd2cf..14d5e5f651d 100644 --- a/php/test/Ice/ini/ClientWithProfile.php +++ b/php/test/Ice/ini/ClientWithProfile.php @@ -27,13 +27,12 @@ function test($b) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); +require_once ('Ice.php'); // // Load the Demo profile. // - $communicator = null; if($NS) diff --git a/php/test/Ice/ini/run.py b/php/test/Ice/ini/run.py deleted file mode 100755 index 5031b335cda..00000000000 --- a/php/test/Ice/ini/run.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -testdir = os.getcwd() - -client = os.path.join(testdir, "Client.php") -sys.stdout.write("testing php INI settings... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False, clientConfig = True, iceOptions = "--Ice.Trace.Network=1 --Ice.Warn.Connections=1") -clientProc.startReader() -clientProc.waitTestSuccess() -print("ok") - -client = os.path.join(testdir, "ClientWithProfile.php") -sys.stdout.write("testing php INI settings with profiles... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False, clientConfig = True, iceOptions = "--Ice.Trace.Network=1 --Ice.Warn.Connections=1", iceProfile="Test") -clientProc.startReader() -clientProc.waitTestSuccess() -print("ok") diff --git a/php/test/Ice/ini/test.py b/php/test/Ice/ini/test.py new file mode 100644 index 00000000000..f2c6e810dc9 --- /dev/null +++ b/php/test/Ice/ini/test.py @@ -0,0 +1,43 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2016 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. +# +# ********************************************************************** + +class IniClient(Client): + + def __init__(self, iceOptions, iceProfile=None, *args, **kargs): + Client.__init__(self, *args, **kargs) + self.iceOptions = iceOptions + self.iceProfile = iceProfile + + def setup(self, current): + if self.iceProfile: + current.createFile("ice.profiles", [ + "[%s]" % self.iceProfile, + "ice.config=\"config.client\"", + "ice.options=\"%s\"" % self.iceOptions, + ]) + current.write("testing... ") + + def teardown(self, current, success): + if success: + current.writeln("ok") + + def getPhpArgs(self, current): + if self.iceProfile: + return ["-d", "ice.profiles=\"ice.profiles\""] + else: + return ["-d", "ice.options=\"{0}\"".format(self.iceOptions), "-d", "ice.config=\"config.client\""] + +TestSuite(__name__, [ + ClientTestCase("php INI settings", + client=IniClient("--Ice.Trace.Network=1 --Ice.Warn.Connections=1")), + ClientTestCase("php INI settings with profiles", + client=IniClient("--Ice.Trace.Network=1 --Ice.Warn.Connections=1", + "Test", + exe="ClientWithProfile.php")) +])
\ No newline at end of file diff --git a/php/test/Ice/objects/.depend.mak b/php/test/Ice/objects/.depend.mak deleted file mode 100644 index 4eba865be84..00000000000 --- a/php/test/Ice/objects/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Test.php: \ - Test.ice diff --git a/php/test/Ice/objects/Client.php b/php/test/Ice/objects/Client.php index 0a45162b565..40a454b92c7 100644 --- a/php/test/Ice/objects/Client.php +++ b/php/test/Ice/objects/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); if($NS) { @@ -30,58 +30,52 @@ if($NS) class Test_D1 extends Test\D1 {} abstract class Test_E extends Test\E {} abstract class Test_F extends Test\F {} - interface Test_I extends Test\I {} - interface Test_J extends Test\J {} class Test_H extends Test\H {} - class Ice_ObjectImpl extends Ice\ObjectImpl {} + class Ice_Value extends Ice\Value {} + class Ice_InterfaceByValue extends Ice\InterfaceByValue {} interface Ice_ObjectFactory extends Ice\ObjectFactory {} + interface Ice_ValueFactory extends Ice\ValueFactory {} EOT; eval($code); } class BI extends Test_B { - function ice_postUnmarshal() + function ice_pretUnmarshal() { - $this->_postUnmarshalInvoked = true; + $this->preUnmarshalInvoked = true; } - function postUnmarshalInvoked() + function ice_postUnmarshal() { - return $this->_postUnmarshalInvoked; + $this->postUnmarshalInvoked = true; } - - private $_postUnmarshalInvoked = false; } class CI extends Test_C { - function ice_postUnmarshal() + function ice_preUnmarshal() { - $this->_postUnmarshalInvoked = true; + $this->preUnmarshalInvoked = true; } - function postUnmarshalInvoked() + function ice_postUnmarshal() { - return $this->_postUnmarshalInvoked; + $this->postUnmarshalInvoked = true; } - - private $_postUnmarshalInvoked = false; } class DI extends Test_D { - function ice_postUnmarshal() + function ice_preUnmarshal() { - $this->_postUnmarshalInvoked = true; + $this->preUnmarshalInvoked = true; } - function postUnmarshalInvoked() + function ice_postUnmarshal() { - return $this->_postUnmarshalInvoked; + $this->postUnmarshalInvoked = true; } - - private $_postUnmarshalInvoked = false; } class EI extends Test_E @@ -112,19 +106,27 @@ class FI extends Test_F } } -class II extends Ice_ObjectImpl implements Test_I +class II extends Ice_InterfaceByValue { + public function __construct() + { + parent::__construct("::Test::I"); + } } -class JI extends Ice_ObjectImpl implements Test_J +class JI extends Ice_InterfaceByValue { + public function __construct() + { + parent::__construct("::Test::J"); + } } class HI extends Test_H { } -class MyObjectFactory implements Ice_ObjectFactory +class MyValueFactory implements Ice_ValueFactory { function create($id) { @@ -162,9 +164,18 @@ class MyObjectFactory implements Ice_ObjectFactory } return null; } +} + +class MyObjectFactory implements Ice_ObjectFactory +{ + function create($id) + { + return null; + } function destroy() { + // Do nothing } } @@ -237,11 +248,11 @@ function allTests($communicator) test($b1->theA->theC != null); test($b1->theA->theC->theB === $b1->theA); test($b1->preMarshalInvoked); - test($b1->postUnmarshalInvoked()); + test($b1->postUnmarshalInvoked); test($b1->theA->preMarshalInvoked); - test($b1->theA->postUnmarshalInvoked()); + test($b1->theA->postUnmarshalInvoked); test($b1->theA->theC->preMarshalInvoked); - test($b1->theA->theC->postUnmarshalInvoked()); + test($b1->theA->theC->postUnmarshalInvoked); // More tests possible for b2 and d, but I think this is already sufficient. test($b2->theA === $b2); test($d->theC == null); @@ -302,13 +313,13 @@ function allTests($communicator) test($d->theB === $b2); test($d->theC == null); test($d->preMarshalInvoked); - test($d->postUnmarshalInvoked()); + test($d->postUnmarshalInvoked); test($d->theA->preMarshalInvoked); - test($d->theA->postUnmarshalInvoked()); + test($d->theA->postUnmarshalInvoked); test($d->theB->preMarshalInvoked); - test($d->theB->postUnmarshalInvoked()); + test($d->theB->postUnmarshalInvoked); test($d->theB->theC->preMarshalInvoked); - test($d->theB->theC->postUnmarshalInvoked()); + test($d->theB->theC->postUnmarshalInvoked); echo "ok\n"; // @@ -345,9 +356,9 @@ function allTests($communicator) $i = $initial->getI(); test($i != null); $j = $initial->getJ(); - test($j != null and $j instanceof Test_J); + test($j != null and $j instanceof JI); $h = $initial->getH(); - test($h != null and $h instanceof Test_H); + test($h != null and $h instanceof HI); echo "ok\n"; echo "getting D1... "; @@ -414,6 +425,14 @@ function allTests($communicator) } echo "ok\n"; + echo "testing marshaled results..."; + flush(); + $b1 = $initial->getMB(); + test($b1 != null && $b1->theB == $b1); + $b1 = $initial->getAMDMB(); + test($b1 != null && $b1->theB == $b1); + echo "ok\n"; + echo "testing UnexpectedObjectException... "; flush(); $ref = "uoet:default -p 12010"; @@ -448,19 +467,31 @@ function allTests($communicator) } echo "ok\n"; + echo "testing getting ObjectFactory... "; + flush(); + test($communicator->findObjectFactory("TestOF") != null); + echo "ok\n"; + + echo "testing getting ObjectFactory as ValueFactory... "; + flush(); + test($communicator->getValueFactoryManager()->find("TestOF") != null); + echo "ok\n"; + return $initial; } -$communicator = Ice_initialize($argv); -$factory = new MyObjectFactory(); -$communicator->addObjectFactory($factory, "::Test::B"); -$communicator->addObjectFactory($factory, "::Test::C"); -$communicator->addObjectFactory($factory, "::Test::D"); -$communicator->addObjectFactory($factory, "::Test::E"); -$communicator->addObjectFactory($factory, "::Test::F"); -$communicator->addObjectFactory($factory, "::Test::I"); -$communicator->addObjectFactory($factory, "::Test::J"); -$communicator->addObjectFactory($factory, "::Test::H"); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); +$factory = new MyValueFactory(); +$communicator->getValueFactoryManager()->add($factory, "::Test::B"); +$communicator->getValueFactoryManager()->add($factory, "::Test::C"); +$communicator->getValueFactoryManager()->add($factory, "::Test::D"); +$communicator->getValueFactoryManager()->add($factory, "::Test::E"); +$communicator->getValueFactoryManager()->add($factory, "::Test::F"); +$communicator->getValueFactoryManager()->add($factory, "::Test::I"); +$communicator->getValueFactoryManager()->add($factory, "::Test::J"); +$communicator->getValueFactoryManager()->add($factory, "::Test::H"); +$communicator->addObjectFactory(new MyObjectFactory(), "TestOF"); $initial = allTests($communicator); $initial->shutdown(); $communicator->destroy(); diff --git a/php/test/Ice/objects/Makefile b/php/test/Ice/objects/Makefile deleted file mode 100644 index de41e9ce180..00000000000 --- a/php/test/Ice/objects/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/objects/Makefile.mak b/php/test/Ice/objects/Makefile.mak deleted file mode 100644 index 4ece14f179d..00000000000 --- a/php/test/Ice/objects/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/objects/Test.ice b/php/test/Ice/objects/Test.ice index a8f8c7018f5..db1d3c67f50 100644 --- a/php/test/Ice/objects/Test.ice +++ b/php/test/Ice/objects/Test.ice @@ -9,6 +9,8 @@ #pragma once +[["suppress-warning:deprecated"]] // For classes with operations + module Test { @@ -37,7 +39,7 @@ class A C theC; bool preMarshalInvoked; - bool postUnmarshalInvoked(); + bool postUnmarshalInvoked; }; class B extends A @@ -50,33 +52,29 @@ class C B theB; bool preMarshalInvoked; - bool postUnmarshalInvoked(); + bool postUnmarshalInvoked; }; class D { A theA; B theB; - C theC; + C theC; bool preMarshalInvoked; - bool postUnmarshalInvoked(); + bool postUnmarshalInvoked; }; ["protected"] class E { int i; string s; - - bool checkValues(); }; class F { ["protected"] E e1; E e2; - - bool checkValues(); }; interface I @@ -134,7 +132,7 @@ exception EDerived extends EBase A1 a4; }; -class Initial +interface Initial { void shutdown(); B getB1(); @@ -144,6 +142,9 @@ class Initial E getE(); F getF(); + ["marshaled-result"] B getMB(); + ["amd", "marshaled-result"] B getAMDMB(); + void getAll(out B b1, out B b2, out C theC, out D theD); I getI(); diff --git a/php/test/Ice/objects/msbuild/test.proj b/php/test/Ice/objects/msbuild/test.proj new file mode 100644 index 00000000000..ef7505718d0 --- /dev/null +++ b/php/test/Ice/objects/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/objects/run.py b/php/test/Ice/objects/run.py deleted file mode 100755 index c217b3d88c2..00000000000 --- a/php/test/Ice/objects/run.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -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/operations/.depend.mak b/php/test/Ice/operations/.depend.mak deleted file mode 100644 index 4eba865be84..00000000000 --- a/php/test/Ice/operations/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Test.php: \ - Test.ice diff --git a/php/test/Ice/operations/Client.php b/php/test/Ice/operations/Client.php index a69896187a4..9d0b5331e92 100644 --- a/php/test/Ice/operations/Client.php +++ b/php/test/Ice/operations/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); function test($b) { @@ -38,9 +38,8 @@ function twoways($communicator, $p) $enum2 = $NS ? constant("Test\\MyEnum::enum2") : constant("Test_MyEnum::enum2"); $enum3 = $NS ? constant("Test\\MyEnum::enum3") : constant("Test_MyEnum::enum3"); + $myClassPrxHelper = $NS ? "Test\\MyClassPrxHelper" : "Test_MyClassPrxHelper"; $myDerivedClassPrxHelper = $NS ? "Test\\MyDerivedClassPrxHelper" : "Test_MyDerivedClassPrxHelper"; - $myDerivedClass = $NS ? "Test\\MyDerivedClass" : "Test_MyDerivedClass"; - $myClass = $NS ? "Test\\MyClass" : "Test_MyClass"; $objectPrxHelper = $NS ? "Ice\\ObjectPrxHelper" : "Ice_ObjectPrxHelper"; @@ -137,7 +136,7 @@ function twoways($communicator, $p) $s10 == $literals[10] && $s10 == $literals[21]); - test($ss0 == "'\"?\\\007\010\f\n\r\t\v" && + test($ss0 == "'\"?\\\007\010\f\n\r\t\v\6" && $ss0 == $ss1 && $ss1 == $ss2 && $ss0 == $literals[22] && @@ -165,16 +164,15 @@ function twoways($communicator, $p) } { - test($myDerivedClassPrxHelper::ice_staticId() == $myDerivedClass::ice_staticId()); test($objectPrxHelper::ice_staticId() == "::Ice::Object"); } { - test($p->ice_isA($myClass::ice_staticId())); + test($p->ice_isA($myClassPrxHelper::ice_staticId())); } { - test($p->ice_id() == $myDerivedClass::ice_staticId()); + test($p->ice_id() == $myDerivedClassPrxHelper::ice_staticId()); } { @@ -356,13 +354,15 @@ function twoways($communicator, $p) } { + $stringToIdentity = $NS ? "Ice\\stringToIdentity" : "Ice_stringToIdentity"; + $r = $p->opMyClass($p, $c1, $c2); test(Ice_proxyIdentityAndFacetEqual($c1, $p)); test(!Ice_proxyIdentityAndFacetEqual($c2, $p)); test(Ice_proxyIdentityAndFacetEqual($r, $p)); - test($c1->ice_getIdentity() == $communicator->stringToIdentity("test")); - test($c2->ice_getIdentity() == $communicator->stringToIdentity("noSuchIdentity")); - test($r->ice_getIdentity() == $communicator->stringToIdentity("test")); + test($c1->ice_getIdentity() == $stringToIdentity("test")); + test($c2->ice_getIdentity() == $stringToIdentity("noSuchIdentity")); + test($r->ice_getIdentity() == $stringToIdentity("test")); $r->opVoid(); $c1->opVoid(); try @@ -1060,10 +1060,36 @@ function twoways($communicator, $p) test(count($p->opByteBoolD1(null)) == 0); test(count($p->opStringS2(null)) == 0); test(count($p->opByteBoolD2(null)) == 0); + + { + $p1 = $p->opMStruct1(); + $p1->e = $enum3; + $p2 = null; + $p3 = $p->opMStruct2($p1, $p2); + test($p2 == $p1 && $p3 == $p1); + } + + { + $p->opMSeq1(); + $p1 = array("test"); + $p2 = null; + $p3 = $p->opMSeq2($p1, $p2); + test($p2[0] == "test" && $p3[0] == "test"); + } + + { + $p->opMDict1(); + $p1 = array("test" => "test"); + $p2 = null; + $p3 = $p->opMDict2($p1, $p2); + test($p3["test"] == "test" && $p2["test"] == "test"); + } } function allTests($communicator) { + global $NS; + $ref = "test:default -p 12010"; $base = $communicator->stringToProxy($ref); $cl = $base->ice_checkedCast("::Test::MyClass"); @@ -1076,10 +1102,18 @@ function allTests($communicator) $derived->opDerived(); echo "ok\n"; + # Test flush batch requests methods + $BasedOnProxy = $NS ? constant("Ice\\CompressBatch::BasedOnProxy") : constant("Ice_CompressBatch::BasedOnProxy"); + + $derived->ice_flushBatchRequests(); + $derived->ice_getConnection()->flushBatchRequests($BasedOnProxy); + $derived->ice_getCommunicator()->flushBatchRequests($BasedOnProxy); + return $cl; } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); $myClass = allTests($communicator); @@ -1101,6 +1135,10 @@ catch(Exception $ex) echo "ok\n"; } +# Test multiple destroy calls +$communicator->destroy(); +$communicator->destroy(); + $communicator->destroy(); exit(); diff --git a/php/test/Ice/operations/Makefile b/php/test/Ice/operations/Makefile deleted file mode 100644 index de41e9ce180..00000000000 --- a/php/test/Ice/operations/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/operations/Makefile.mak b/php/test/Ice/operations/Makefile.mak deleted file mode 100644 index 4ece14f179d..00000000000 --- a/php/test/Ice/operations/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/operations/Test.ice b/php/test/Ice/operations/Test.ice index 23a4f1ba4b1..3da80e8a635 100644 --- a/php/test/Ice/operations/Test.ice +++ b/php/test/Ice/operations/Test.ice @@ -19,7 +19,7 @@ enum MyEnum enum3 }; -class MyClass; +interface MyClass; struct AnotherStruct { @@ -79,7 +79,7 @@ dictionary<string, DoubleS> StringDoubleSD; dictionary<string, StringS> StringStringSD; dictionary<MyEnum, MyEnumS> MyEnumMyEnumSD; -class MyClass +interface MyClass { void shutdown(); @@ -226,6 +226,15 @@ class MyClass ByteBoolD opByteBoolD2(ByteBoolD byteBoolD); StringS opStringLiterals(); + + ["marshaled-result"] Structure opMStruct1(); + ["marshaled-result"] Structure opMStruct2(Structure p1, out Structure p2); + + ["marshaled-result"] StringS opMSeq1(); + ["marshaled-result"] StringS opMSeq2(StringS p1, out StringS p2); + + ["marshaled-result"] StringStringD opMDict1(); + ["marshaled-result"] StringStringD opMDict2(StringStringD p1, out StringStringD p2); }; // Test data member with same name as class @@ -244,7 +253,7 @@ class MyClass1 string myClass1; // Same name as the enclosing class }; -class MyDerivedClass extends MyClass +interface MyDerivedClass extends MyClass { void opDerived(); MyStruct1 opMyStruct1(MyStruct1 s); @@ -293,9 +302,9 @@ const string sw10 = "\U00000DA7"; // Sinhala Letter Alpapraa \v vertical tab byte 0x0b in ASCII encoding **/ -const string ss0 = "\'\"\?\\\a\b\f\n\r\t\v"; -const string ss1 = "\u0027\u0022\u003f\u005c\u0007\u0008\u000c\u000a\u000d\u0009\u000b"; -const string ss2 = "\U00000027\U00000022\U0000003f\U0000005c\U00000007\U00000008\U0000000c\U0000000a\U0000000d\U00000009\U0000000b"; +const string ss0 = "\'\"\?\\\a\b\f\n\r\t\v\6"; +const string ss1 = "\u0027\u0022\u003f\u005c\u0007\u0008\u000c\u000a\u000d\u0009\u000b\u0006"; +const string ss2 = "\U00000027\U00000022\U0000003f\U0000005c\U00000007\U00000008\U0000000c\U0000000a\U0000000d\U00000009\U0000000b\U00000006"; const string ss3 = "\\\\U\\u\\"; /* \\U\u\ */ const string ss4 = "\\\u0041\\"; /* \A\ */ diff --git a/php/test/Ice/operations/msbuild/test.proj b/php/test/Ice/operations/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Ice/operations/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/operations/run.py b/php/test/Ice/operations/run.py deleted file mode 100755 index 7c438435006..00000000000 --- a/php/test/Ice/operations/run.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with AMD server.") -TestUtil.clientServerTest(server="serveramd") diff --git a/php/test/Ice/optional/.depend.mak b/php/test/Ice/optional/.depend.mak deleted file mode 100644 index a35bc02cce2..00000000000 --- a/php/test/Ice/optional/.depend.mak +++ /dev/null @@ -1,7 +0,0 @@ - -ClientPrivate.php: \ - ClientPrivate.ice \ - ./Test.ice - -Test.php: \ - Test.ice diff --git a/php/test/Ice/optional/Client.php b/php/test/Ice/optional/Client.php index 7e53fea9482..7c6248fa226 100644 --- a/php/test/Ice/optional/Client.php +++ b/php/test/Ice/optional/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'ClientPrivate.php'; +require_once('Ice.php'); +require_once('ClientPrivate.php'); function test($b) { @@ -101,17 +101,13 @@ function allTests($communicator) $vscls = $NS ? "Test\\VarStruct" : "Test_VarStruct"; $vs = new $vscls("hello"); $prx = $communicator->stringToProxy("test"); - $moprx = $NS ? eval("return Test\\MultiOptionalPrxHelper::uncheckedCast(\$prx);") : - eval("return Test_MultiOptionalPrxHelper::uncheckedCast(\$prx);"); - $ooprx = $NS ? eval("return Test\\OneOptionalPrxHelper::uncheckedCast(\$prx);") : - eval("return Test_OneOptionalPrxHelper::uncheckedCast(\$prx);"); $oo15 = new $oocls(15); $mocls = $NS ? "Test\\MultiOptional" : "Test_MultiOptional"; $mo1 = new $mocls(15, true, 19, 78, 99, 5.5, 1.0, 'test', $enum, - $moprx, null, array(5), array('test', 'test2'), array(4=>3), array('test'=>10), + $prx, null, array(5), array('test', 'test2'), array(4=>3), array('test'=>10), $fs, $vs, array(1), array($enum, $enum), array($fs), array($vs), array($oo1), - array($ooprx), array(4=>$enum), array(4=>$fs), array(5=>$vs), - array(5=>$oo15), array(5=>$ooprx), array(false, true, false)); + array($prx), array(4=>$enum), array(4=>$fs), array(5=>$vs), + array(5=>$oo15), array(5=>$prx), array(false, true, false)); test($mo1->a == 15); test($mo1->b == true); @@ -122,7 +118,7 @@ function allTests($communicator) test($mo1->g == 1.0); test($mo1->h == "test"); test($mo1->i == $enum); - test($mo1->j == $moprx); + test($mo1->j == $prx); test($mo1->k == null); test($mo1->bs == array(5)); test($mo1->ss == array("test", "test2")); @@ -136,13 +132,13 @@ function allTests($communicator) test($mo1->fss[0] == $fs); test($mo1->vss[0] == $vs); test($mo1->oos[0] == $oo1); - test($mo1->oops[0] == $ooprx); + test($mo1->oops[0] == $prx); test($mo1->ied[4] == $enum); test($mo1->ifsd[4] == $fs); test($mo1->ivsd[5] == $vs); test($mo1->iood[5]->a == 15); - test($mo1->ioopd[5] == $ooprx); + test($mo1->ioopd[5] == $prx); test($mo1->bos == array(false, true, false)); @@ -223,13 +219,13 @@ function allTests($communicator) test($mo5->fss[0] == $fs); test($mo5->vss[0] == $vs); test($mo5->oos[0]->a == 15); - test($mo5->oops[0] == $ooprx); + test($mo5->oops[0] == $prx); test($mo5->ied[4] == $enum); test($mo5->ifsd[4] == $fs); test($mo5->ivsd[5] == $vs); test($mo5->iood[5]->a == 15); - test($mo5->ioopd[5] == $ooprx); + test($mo5->ioopd[5] == $prx); test($mo5->bos == $mo1->bos); @@ -328,13 +324,13 @@ function allTests($communicator) test($mo9->fss == Ice_Unset); test($mo9->vss[0] == $vs); test($mo9->oos == Ice_Unset); - test($mo9->oops[0] == $ooprx); + test($mo9->oops[0] == $prx); test($mo9->ied[4] == $enum); test($mo9->ifsd == Ice_Unset); test($mo9->ivsd[5] == $vs); test($mo9->iood == Ice_Unset); - test($mo9->ioopd[5] == $ooprx); + test($mo9->ioopd[5] == $prx); test($mo9->bos == Ice_Unset); @@ -572,8 +568,8 @@ function allTests($communicator) $p3 = $initial->opOneOptionalProxy(Ice_Unset, $p2); test($p2 == Ice_Unset && $p3 == Ice_Unset); - $p3 = $initial->opOneOptionalProxy($ooprx, $p2); - test($p2 == $ooprx && $p3 == $ooprx); + $p3 = $initial->opOneOptionalProxy($prx, $p2); + test($p2 == $prx && $p3 == $prx); $p3 = $initial->opByteSeq(Ice_Unset, $p2); test($p2 == Ice_Unset && $p3 == Ice_Unset); @@ -697,6 +693,12 @@ function allTests($communicator) $p3 = $initial->opStringIntDict($p1, $p2); test($p2 == $p1 && $p3 == $p1); + $p3 = $initial->opIntOneOptionalDict(Ice_Unset, $p2); + test($p2 == Ice_Unset && $p3 == Ice_Unset); + $p1 = array(1=>new $oocls(58), 2=>new $oocls(59)); + $p3 = $initial->opIntOneOptionalDict($p1, $p2); + test($p2[1]->a == 58 && $p3[1]->a == 58); + echo "ok\n"; echo "testing exception optionals... "; @@ -797,10 +799,50 @@ function allTests($communicator) echo "ok\n"; + echo "testing optionals with marshaled results... "; + flush(); + + test($initial->opMStruct1() != Ice_Unset); + test($initial->opMDict1() != Ice_Unset); + test($initial->opMSeq1() != Ice_Unset); + test($initial->opMG1() != Ice_Unset); + + $p3 = $initial->opMStruct2(Ice_Unset, $p2); + test($p2 == Ice_Unset && $p3 == Ice_Unset); + + $sscls = $NS ? "Test\\SmallStruct" : "Test_SmallStruct"; + $p1 = new $sscls(56); + $p3 = $initial->opMStruct2($p1, $p2); + test($p2 == $p1 && $p3 == $p1); + + $p3 = $initial->opMSeq2(Ice_Unset, $p2); + test($p2 == Ice_Unset && $p3 == Ice_Unset); + + $p1 = array("hello"); + $p3 = $initial->opMSeq2($p1, $p2); + test($p2[0] == "hello" && $p3[0] == "hello"); + + $p3 = $initial->opMDict2(Ice_Unset, $p2); + test($p2 == Ice_Unset && $p3 == Ice_Unset); + + $p1 = array("test" => 54); + $p3 = $initial->opMDict2($p1, $p2); + test($p2["test"] == 54 && $p3["test"] == 54); + + $p3 = $initial->opMG2(Ice_Unset, $p2); + test($p2 == Ice_Unset && $p3 == Ice_Unset); + + $p1 = new $gcls; + $p3 = $initial->opMG2($p1, $p2); + test($p2 != Ice_Unset && $p3 != Ice_Unset && $p3 == $p2); + + echo "ok\n"; + return $initial; } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); $initial = allTests($communicator); diff --git a/php/test/Ice/optional/ClientPrivate.ice b/php/test/Ice/optional/ClientPrivate.ice index 866fabc1905..ddb03cd4aa5 100644 --- a/php/test/Ice/optional/ClientPrivate.ice +++ b/php/test/Ice/optional/ClientPrivate.ice @@ -29,7 +29,7 @@ class D extends B // on the server and pass an optional argument. This isn't necessary in other language // mappings where the public stream API is available. // -class Initial2 +interface Initial2 { void opClassAndUnknownOptional(A p, optional(1) Object o); diff --git a/php/test/Ice/optional/Makefile b/php/test/Ice/optional/Makefile deleted file mode 100644 index e6f163a3ea4..00000000000 --- a/php/test/Ice/optional/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = ClientPrivate.ice Test.ice - -SLICE2PHPFLAGS = -I. - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/optional/Makefile.mak b/php/test/Ice/optional/Makefile.mak deleted file mode 100644 index 8c3d3a3e74f..00000000000 --- a/php/test/Ice/optional/Makefile.mak +++ /dev/null @@ -1,15 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = ClientPrivate.ice Test.ice -SLICE2PHPFLAGS = -I. - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/optional/Test.ice b/php/test/Ice/optional/Test.ice index 0f2b2f5054b..1263f971a9e 100644 --- a/php/test/Ice/optional/Test.ice +++ b/php/test/Ice/optional/Test.ice @@ -189,7 +189,7 @@ class G G1 gg1; }; -class Initial +interface Initial { void shutdown(); @@ -264,19 +264,41 @@ class Initial optional(1) StringIntDict opStringIntDict(optional(2) StringIntDict p1, out optional(3) StringIntDict p3); + optional(1) IntOneOptionalDict opIntOneOptionalDict(optional(2) IntOneOptionalDict p1, + out optional(3) IntOneOptionalDict p3); + void opClassAndUnknownOptional(A p); void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + ["marshaled-result"] optional(1) SmallStruct opMStruct1(); + ["marshaled-result"] optional(1) SmallStruct opMStruct2(optional(2) SmallStruct p1, + out optional(3)SmallStruct p2); + + ["marshaled-result"] optional(1) StringSeq opMSeq1(); + ["marshaled-result"] optional(1) StringSeq opMSeq2(optional(2) StringSeq p1, + out optional(3) StringSeq p2); + + ["marshaled-result"] optional(1) StringIntDict opMDict1(); + ["marshaled-result"] optional(1) StringIntDict opMDict2(optional(2) StringIntDict p1, + out optional(3) StringIntDict p2); + + ["marshaled-result"] optional(1) G opMG1(); + ["marshaled-result"] optional(1) G opMG2(optional(2) G p1, out optional(3) G p2); + bool supportsRequiredParams(); bool supportsJavaSerializable(); bool supportsCsharpSerializable(); + + bool supportsCppStringView(); + + bool supportsNullOptional(); }; }; diff --git a/php/test/Ice/optional/msbuild/test.proj b/php/test/Ice/optional/msbuild/test.proj new file mode 100644 index 00000000000..cf775363aa8 --- /dev/null +++ b/php/test/Ice/optional/msbuild/test.proj @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <PropertyGroup> + <IceBuilderIncludeDirectories>..;$(IceBuilderIncludeDirectories)</IceBuilderIncludeDirectories> + </PropertyGroup> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/optional/run.py b/php/test/Ice/optional/run.py deleted file mode 100755 index 50fc969174b..00000000000 --- a/php/test/Ice/optional/run.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -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") diff --git a/php/test/Ice/proxy/.depend.mak b/php/test/Ice/proxy/.depend.mak deleted file mode 100644 index 4eba865be84..00000000000 --- a/php/test/Ice/proxy/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Test.php: \ - Test.ice diff --git a/php/test/Ice/proxy/Client.php b/php/test/Ice/proxy/Client.php index b84d9aa029a..a56eaa54f04 100644 --- a/php/test/Ice/proxy/Client.php +++ b/php/test/Ice/proxy/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); function test($b) { @@ -30,18 +30,29 @@ function test($b) } } +function currentEncodingToString() +{ + global $NS; + return $NS ? eval("return Ice\\encodingVersionToString(Ice\\currentEncoding());") : + eval("return Ice_encodingVersionToString(Ice_currentEncoding());"); +} + function allTests($communicator) { global $NS; global $Ice_Encoding_1_0; global $Ice_Encoding_1_1; + $identity = $NS ? "Ice\\Identity" : "Ice_Identity"; $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"; $identityToString = $NS ? "Ice\\identityToString" : "Ice_identityToString"; $stringToIdentity = $NS ? "Ice\\stringToIdentity" : "Ice_stringToIdentity"; + $modeUnicode = $NS ? constant("Ice\\ToStringMode::Unicode") : constant("Ice_ToStringMode::Unicode"); + $modeASCII = $NS ? constant("Ice\\ToStringMode::ASCII") : constant("Ice_ToStringMode::ASCII"); + $modeCompat = $NS ? constant("Ice\\ToStringMode::Compat") : constant("Ice_ToStringMode::Compat"); echo "testing stringToProxy... "; flush(); @@ -415,14 +426,14 @@ function allTests($communicator) test($proxyProps["Test.EndpointSelection"] == "Ordered"); test($proxyProps["Test.LocatorCacheTimeout"] == "100"); - test($proxyProps["Test.Locator"] == "locator -t -e " . Ice_encodingVersionToString(Ice_currentEncoding())); + test($proxyProps["Test.Locator"] == "locator -t -e " . currentEncodingToString()); //test($proxyProps["Test.Locator.CollocationOptimized"] == "1"); test($proxyProps["Test.Locator.ConnectionCached"] == "0"); test($proxyProps["Test.Locator.PreferSecure"] == "1"); test($proxyProps["Test.Locator.EndpointSelection"] == "Random"); test($proxyProps["Test.Locator.LocatorCacheTimeout"] == "300"); - test($proxyProps["Test.Locator.Router"] == "router -t -e " . Ice_encodingVersionToString(Ice_currentEncoding())); + test($proxyProps["Test.Locator.Router"] == "router -t -e " . currentEncodingToString()); //test($proxyProps["Test.Locator.Router.CollocationOptimized"] == "0"); test($proxyProps["Test.Locator.Router.ConnectionCached"] == "1"); test($proxyProps["Test.Locator.Router.PreferSecure"] == "1"); @@ -439,7 +450,31 @@ function allTests($communicator) echo "testing proxy methods... "; flush(); test($communicator->identityToString($base->ice_identity($communicator->stringToIdentity("other"))->ice_getIdentity()) == "other"); - test($identityToString($base->ice_identity($stringToIdentity("other"))->ice_getIdentity()) == "other"); + + // + // Verify that ToStringMode is passed correctly + // + $ident = eval("return new " . $identity . "('test', '\x7F\xE2\x82\xAC');"); + + $idStr = $identityToString($ident, $modeUnicode); + test($idStr == "\\u007f\xE2\x82\xAC/test"); + $ident2 = $stringToIdentity($idStr); + test($ident == $ident2); + test($identityToString($ident) == $idStr); + + $idStr = $identityToString($ident, $modeASCII); + test($idStr == "\\u007f\\u20ac/test"); + $ident2 = $stringToIdentity($idStr); + test($ident == $ident2); + + $idStr = $identityToString($ident, $modeCompat); + test($idStr == "\\177\\342\\202\\254/test"); + $ident2 = $stringToIdentity($idStr); + test($ident == $ident2); + + $ident2 = $stringToIdentity($communicator->identityToString($ident)); + test($ident == $ident2); + test($base->ice_facet("facet")->ice_getFacet() == "facet"); test($base->ice_adapterId("id")->ice_getAdapterId() == "id"); test($base->ice_twoway()->ice_isTwoway()); @@ -771,7 +806,8 @@ function allTests($communicator) return $cl; } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); $myClass = allTests($communicator); $myClass->shutdown(); $communicator->destroy(); diff --git a/php/test/Ice/proxy/Makefile b/php/test/Ice/proxy/Makefile deleted file mode 100644 index de41e9ce180..00000000000 --- a/php/test/Ice/proxy/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/proxy/Makefile.mak b/php/test/Ice/proxy/Makefile.mak deleted file mode 100644 index 4ece14f179d..00000000000 --- a/php/test/Ice/proxy/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/proxy/Test.ice b/php/test/Ice/proxy/Test.ice index 98f037c1632..365f7bffd81 100644 --- a/php/test/Ice/proxy/Test.ice +++ b/php/test/Ice/proxy/Test.ice @@ -14,14 +14,14 @@ module Test dictionary<string, string> Context; -class MyClass +interface MyClass { void shutdown(); Context getContext(); }; -class MyDerivedClass extends MyClass +interface MyDerivedClass extends MyClass { Object* echo(Object* obj); }; diff --git a/php/test/Ice/proxy/msbuild/test.proj b/php/test/Ice/proxy/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Ice/proxy/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/proxy/run.py b/php/test/Ice/proxy/run.py deleted file mode 100755 index 7c438435006..00000000000 --- a/php/test/Ice/proxy/run.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with AMD server.") -TestUtil.clientServerTest(server="serveramd") diff --git a/php/test/Ice/scope/Client.php b/php/test/Ice/scope/Client.php index d161665c5aa..dbe0085a49d 100644 --- a/php/test/Ice/scope/Client.php +++ b/php/test/Ice/scope/Client.php @@ -18,9 +18,8 @@ if(!extension_loaded("ice")) function foo() { - $NS = function_exists("Ice\\initialize"); - require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); - require_once 'IceGrid.php'; + require_once('Ice.php'); + require_once('IceGrid.php'); } echo "testing generated code in a non-global scope... "; diff --git a/php/test/Ice/scope/run.py b/php/test/Ice/scope/run.py deleted file mode 100755 index 3bd3723b40d..00000000000 --- a/php/test/Ice/scope/run.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -testdir = os.getcwd() - -client = os.path.join(testdir, "Client.php") -clientProc = TestUtil.startClient(client, startReader = False) -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/php/test/Ice/slicing/Makefile b/php/test/Ice/slicing/Makefile deleted file mode 100644 index 92376d38e1d..00000000000 --- a/php/test/Ice/slicing/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -include $(top_srcdir)/config/Make.rules.php - -SUBDIRS = exceptions objects - -$(EVERYTHING):: - @for subdir in $(SUBDIRS); \ - do \ - echo "making $@ in $$subdir"; \ - ( cd $$subdir && $(MAKE) $@ ) || exit 1; \ - done diff --git a/php/test/Ice/slicing/Makefile.mak b/php/test/Ice/slicing/Makefile.mak deleted file mode 100644 index cc3d99a6cba..00000000000 --- a/php/test/Ice/slicing/Makefile.mak +++ /dev/null @@ -1,19 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -!include $(top_srcdir)\config\Make.rules.mak.php - -SUBDIRS = exceptions objects - -$(EVERYTHING):: - @for %i in ( $(SUBDIRS) ) do \ - @echo "making $@ in %i" && \ - cmd /c "cd %i && $(MAKE) -nologo -f Makefile.mak $@" || exit 1 diff --git a/php/test/Ice/slicing/exceptions/.depend.mak b/php/test/Ice/slicing/exceptions/.depend.mak deleted file mode 100644 index 4eba865be84..00000000000 --- a/php/test/Ice/slicing/exceptions/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Test.php: \ - Test.ice diff --git a/php/test/Ice/slicing/exceptions/Client.php b/php/test/Ice/slicing/exceptions/Client.php index db410f4366a..1964847ac70 100644 --- a/php/test/Ice/slicing/exceptions/Client.php +++ b/php/test/Ice/slicing/exceptions/Client.php @@ -1,4 +1,4 @@ -<? +<?php error_reporting(E_ALL | E_STRICT); if(!extension_loaded("ice")) @@ -8,8 +8,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); function test($b) { @@ -425,7 +425,9 @@ function allTests($communicator) return $test; } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); + $test = allTests($communicator); $test->shutdown(); $communicator->destroy(); diff --git a/php/test/Ice/slicing/exceptions/Makefile b/php/test/Ice/slicing/exceptions/Makefile deleted file mode 100644 index f1ddad49110..00000000000 --- a/php/test/Ice/slicing/exceptions/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../../.. - -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/slicing/exceptions/Makefile.mak b/php/test/Ice/slicing/exceptions/Makefile.mak deleted file mode 100644 index f9ce6f693eb..00000000000 --- a/php/test/Ice/slicing/exceptions/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/slicing/exceptions/msbuild/test.proj b/php/test/Ice/slicing/exceptions/msbuild/test.proj new file mode 100644 index 00000000000..93c84626dcc --- /dev/null +++ b/php/test/Ice/slicing/exceptions/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/slicing/exceptions/run.py b/php/test/Ice/slicing/exceptions/run.py deleted file mode 100755 index 3cc11eccf33..00000000000 --- a/php/test/Ice/slicing/exceptions/run.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -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/.depend.mak b/php/test/Ice/slicing/objects/.depend.mak deleted file mode 100644 index 6b5b452508e..00000000000 --- a/php/test/Ice/slicing/objects/.depend.mak +++ /dev/null @@ -1,10 +0,0 @@ - -ClientPrivate.php: \ - ClientPrivate.ice \ - ./Test.ice - -Forward.php: \ - Forward.ice - -Test.php: \ - Test.ice diff --git a/php/test/Ice/slicing/objects/.gitignore b/php/test/Ice/slicing/objects/.gitignore index cde67ff9c11..a3053d5debf 100644 --- a/php/test/Ice/slicing/objects/.gitignore +++ b/php/test/Ice/slicing/objects/.gitignore @@ -1,3 +1,2 @@ ClientPrivate.php -Forward.php Test.php diff --git a/php/test/Ice/slicing/objects/Client.php b/php/test/Ice/slicing/objects/Client.php index 13f7ea4bbd1..7c1f5090baf 100644 --- a/php/test/Ice/slicing/objects/Client.php +++ b/php/test/Ice/slicing/objects/Client.php @@ -1,4 +1,4 @@ -<? +<?php error_reporting(E_ALL | E_STRICT); if(!extension_loaded("ice")) @@ -8,9 +8,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Forward.php'; -require_once 'ClientPrivate.php'; +require_once('Ice.php'); +require_once('ClientPrivate.php'); function test($b) { @@ -103,7 +102,7 @@ function allTests($communicator) } catch(Exception $ex) { - test(get_class($ex) == ($NS ? "Ice\\NoObjectFactoryException" : "Ice_NoObjectFactoryException")); + test(get_class($ex) == ($NS ? "Ice\\NoValueFactoryException" : "Ice_NoValueFactoryException")); } } echo "ok\n"; @@ -111,7 +110,7 @@ function allTests($communicator) echo "unknown with Object as Object... "; flush(); { - $usocls = $NS ? "Ice\\UnknownSlicedObject" : "Ice_UnknownSlicedObject"; + $usocls = $NS ? "Ice\\UnknownSlicedValue" : "Ice_UnknownSlicedValue"; try { $o = $test->SUnknownAsObject(); @@ -123,7 +122,7 @@ function allTests($communicator) } catch(Exception $b) { - $excls = $NS ? "Ice\\NoObjectFactoryException" : "Ice_NoObjectFactoryException"; + $excls = $NS ? "Ice\\NoValueFactoryException" : "Ice_NoValueFactoryException"; if($b instanceof $excls) { test($test->ice_getEncodingVersion() == $Ice_Encoding_1_0); @@ -1060,7 +1059,8 @@ function allTests($communicator) return $test; } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); $test = allTests($communicator); $test->shutdown(); $communicator->destroy(); diff --git a/php/test/Ice/slicing/objects/Makefile b/php/test/Ice/slicing/objects/Makefile deleted file mode 100644 index c39e616d1fa..00000000000 --- a/php/test/Ice/slicing/objects/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../../.. - -SLICE_SRCS = ClientPrivate.ice Forward.ice Test.ice - -SLICE2PHPFLAGS = -I. - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Ice/slicing/objects/Makefile.mak b/php/test/Ice/slicing/objects/Makefile.mak deleted file mode 100644 index 1d24a07e804..00000000000 --- a/php/test/Ice/slicing/objects/Makefile.mak +++ /dev/null @@ -1,16 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\..\.. - -SLICE_SRCS = ClientPrivate.ice Forward.ice Test.ice - -SLICE2PHPFLAGS = -I. - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Ice/slicing/objects/Test.ice b/php/test/Ice/slicing/objects/Test.ice index b9936669b30..89f2780c352 100644 --- a/php/test/Ice/slicing/objects/Test.ice +++ b/php/test/Ice/slicing/objects/Test.ice @@ -66,7 +66,7 @@ exception DerivedException extends BaseException D1 pd1; }; -class Forward; /* Forward-declared class defined in another compilation unit */ +class Forward; class PBase { @@ -160,5 +160,15 @@ interface TestIntf void shutdown(); }; +class Hidden +{ + Forward f; +}; + +class Forward +{ + Hidden h; +}; + }; diff --git a/php/test/Ice/slicing/objects/msbuild/test.proj b/php/test/Ice/slicing/objects/msbuild/test.proj new file mode 100644 index 00000000000..13465fc60d3 --- /dev/null +++ b/php/test/Ice/slicing/objects/msbuild/test.proj @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <PropertyGroup> + <IceBuilderIncludeDirectories>..;$(IceBuilderIncludeDirectories)</IceBuilderIncludeDirectories> + </PropertyGroup> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Ice/slicing/objects/run.py b/php/test/Ice/slicing/objects/run.py deleted file mode 100755 index 3cc11eccf33..00000000000 --- a/php/test/Ice/slicing/objects/run.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -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/timeout/Client.php b/php/test/Ice/timeout/Client.php new file mode 100644 index 00000000000..0d47279f2d6 --- /dev/null +++ b/php/test/Ice/timeout/Client.php @@ -0,0 +1,370 @@ +<?php +// ********************************************************************** +// +// Copyright (c) 2003-2016 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. +// +// ********************************************************************** + +error_reporting(E_ALL | E_STRICT); + +// +// We need to ensure that the memory limit is high enough +// to run this tests. +// +ini_set('memory_limit', '1024M'); + +if(!extension_loaded("ice")) +{ + echo "\nerror: Ice extension is not loaded.\n\n"; + exit(1); +} + +$NS = function_exists("Ice\\initialize"); +require_once('Ice.php'); +require_once('Test.php'); + +function test($b) +{ + if(!$b) + { + $bt = debug_backtrace(); + echo "\ntest failed in ".$bt[0]["file"]." line ".$bt[0]["line"]."\n"; + exit(1); + } +} + +function allTests($communicator) +{ + global $NS; + $ConnectTimeoutException = $NS ? "Ice\\ConnectTimeoutException" : "Ice_ConnectTimeoutException"; + $TimeoutException = $NS ? "Ice\\TimeoutException" : "Ice_TimeoutException"; + $InvocationTimeoutException = $NS ? "Ice\\InvocationTimeoutException" : "Ice_InvocationTimeoutException"; + $CloseGracefullyAndWait = constant($NS ? "Ice\\ConnectionClose::GracefullyWithWait" : + "Ice_ConnectionClose::GracefullyWithWait"); + $InitializationData = $NS ? "Ice\\InitializationData" : "Ice_InitializationData"; + + $sref = "timeout:default -p 12010"; + $timeout = $communicator->stringToProxy($sref); + test($timeout); + + $timeout = $timeout->ice_checkedCast("::Test::Timeout"); + test($timeout); + + echo("testing connect timeout... "); + flush(); + + { + // + // Expect ConnectTimeoutException. + // + $to = $timeout->ice_timeout(100); + $timeout->holdAdapter(500); + try + { + $to->op(); + test(false); + } + catch(Exception $ex) + { + test($ex instanceof $ConnectTimeoutException); + } + } + { + // + // Expect success. + // + $timeout->op(); // Ensure adapter is active. + $to =$timeout->ice_timeout(1000); + $timeout->holdAdapter(500); + try + { + $to->op(); + } + catch(Exception $ex) + { + test(false); + } + } + echo("ok\n"); + + // The sequence needs to be large enough to fill the write/recv buffers + $seq = array_fill(0, 2000000, 0x01); + echo("testing connection timeout... "); + flush(); + { + // + // Expect TimeoutException. + // + $to = $timeout->ice_timeout(100)->ice_uncheckedCast("::Test::Timeout"); + $timeout->holdAdapter(500); + try + { + $to->sendData($seq); + test(false); + } + catch(Exception $ex) + { + // Expected. + test($ex instanceof $TimeoutException); + } + } + { + // + // Expect success. + // + $timeout->op(); // Ensure adapter is active. + $to = $timeout->ice_timeout(1000)->ice_uncheckedCast("::Test::Timeout"); + $timeout->holdAdapter(500); + try + { + $data = array_fill(0, 1000000, 0x01); + $to->sendData($data); + } + catch(Exception $ex) + { + test(false); + } + } + echo("ok\n"); + + echo("testing invocation timeout... "); + flush(); + { + $connection = $timeout->ice_getConnection(); + $to = $timeout->ice_invocationTimeout(100)->ice_uncheckedCast("::Test::Timeout"); + test($connection == $to->ice_getConnection()); + try + { + $to->sleep(750); + test(false); + } + catch(Exception $ex) + { + test($ex instanceof $InvocationTimeoutException); + } + + $timeout->ice_ping(); + $to = $timeout->ice_invocationTimeout(500)->ice_checkedCast("::Test::Timeout"); + test($connection == $to->ice_getConnection()); + try + { + $to->sleep(250); + } + catch(Exception $ex) + { + test(false); + } + test($connection == $to->ice_getConnection()); + } + { + // + // Backward compatible connection timeouts + // + $to = $timeout->ice_invocationTimeout(-2)->ice_timeout(100)->ice_uncheckedCast("::Test::Timeout"); + $con = null; + try + { + $con = $to->ice_getConnection(); + $to->sleep(750); + test(false); + } + catch(Exception $ex) + { + try + { + $con->getInfo(); + test(false); + } + catch(Exception $ex) + { + // Connection got closed as well. + test($ex instanceof $TimeoutException); + } + } + $timeout->ice_ping(); + } + echo("ok\n"); + + echo("testing close timeout... "); + flush(); + { + $to = $timeout->ice_timeout(100)->ice_uncheckedCast("::Test::Timeout"); + $connection = $to->ice_getConnection(); + $timeout->holdAdapter(500); + $connection->close($CloseGracefullyAndWait); + try + { + $connection->getInfo(); // getInfo() doesn't throw in the closing state. + } + catch(Exception $ex) + { + test(false); + } + usleep(500 * 1000); + try + { + $connection->getInfo(); + test(false); + } + catch(Exception $ex) + { + // Expected. + test($ex->graceful); + } + $timeout->op(); // Ensure adapter is active. + } + echo("ok\n"); + + echo("testing timeout overrides... "); + flush(); + { + // + // Test Ice.Override.Timeout. This property overrides all + // endpoint timeouts. + // + $initData = eval($NS ? "return new Ice\\InitializationData();" : "return new Ice_InitializationData();"); + $initData->properties = $communicator->getProperties()->clone(); + $initData->properties->setProperty("Ice.Override.Timeout", "100"); + $comm = eval($NS ? "return Ice\\initialize(\$initData);" : "return Ice_initialize(\$initData);"); + $to = $comm->stringToProxy($sref)->ice_uncheckedCast("::Test::Timeout"); + $timeout->holdAdapter(700); + try + { + $to->sendData($seq); + test(false); + } + catch(Exception $ex) + { + // Expected. + test($ex instanceof $TimeoutException); + } + // + // Calling ice_timeout() should have no effect. + // + $timeout->op(); // Ensure adapter is active. + $to = $to->ice_timeout(1000); + $timeout->holdAdapter(500); + try + { + $to->sendData($seq); + test(false); + } + catch(Exception $ex) + { + // Expected. + test($ex instanceof $TimeoutException); + } + $comm->destroy(); + } + { + // + // Test Ice.Override.ConnectTimeout. + // + $initData = eval($NS ? "return new Ice\\InitializationData();" : "return new Ice_InitializationData();"); + $initData->properties = $communicator->getProperties()->clone(); + $initData->properties->setProperty("Ice.Override.ConnectTimeout", "250"); + $comm = eval($NS ? "return Ice\\initialize(\$initData);" : "return Ice_initialize(\$initData);"); + $to = $comm->stringToProxy($sref)->ice_uncheckedCast("::Test::Timeout"); + $timeout->holdAdapter(750); + try + { + $to->op(); + test(false); + } + catch(Exception $ex) + { + // Expected. + test($ex instanceof $ConnectTimeoutException); + } + // + // Calling ice_timeout() should have no effect on the connect timeout. + // + $timeout->op(); // Ensure adapter is active. + $timeout->holdAdapter(750); + $to = $to->ice_timeout(1000)->ice_uncheckedCast("::Test::Timeout"); + try + { + $to->op(); + test(false); + } + catch(Exception $ex) + { + // Expected. + test($ex instanceof $ConnectTimeoutException); + } + // + // Verify that timeout set via ice_timeout() is still used for requests. + // + $timeout->op(); // Ensure adapter is active. + $to = $to->ice_timeout(250)->ice_uncheckedCast("::Test::Timeout"); + $to->ice_getConnection(); // Establish connection. + $timeout->holdAdapter(750); + try + { + $to->sendData($seq); + test(false); + } + catch(Exception $ex) + { + // Expected. + test($ex instanceof $TimeoutException); + } + $comm->destroy(); + } + { + // + // Test Ice.Override.CloseTimeout. + // + $initData = eval($NS ? "return new Ice\\InitializationData();" : "return new Ice_InitializationData();"); + $initData->properties = $communicator->getProperties()->clone(); + $initData->properties->setProperty("Ice.Override.CloseTimeout", "100"); + $comm = eval($NS ? "return Ice\\initialize(\$initData);" : "return Ice_initialize(\$initData);"); + $to = $comm->stringToProxy($sref)->ice_uncheckedCast("::Test::Timeout"); + $timeout->holdAdapter(800); + + $begin = microtime(true); + $comm->destroy(); + test(microtime(true) - $begin < 0.7); + } + echo("ok\n"); + + $timeout->shutdown(); + $communicator->destroy(); +} + + +$initData = eval($NS ? "return new Ice\\InitializationData();" : "return new Ice_InitializationData();"); + +$initData->properties = eval($NS ? "return Ice\\createProperties(\$argv);" : "return Ice_createProperties(\$argv);"); +// +// We need to send messages large enough to cause the transport +// buffers to fill up. +// +$initData->properties->setProperty("Ice.MessageSizeMax", "20000"); + +// +// For this test, we want to disable retries. +// +$initData->properties->setProperty("Ice.RetryIntervals", "-1"); + +// +// This test kills connections, so we don't want warnings. +// +$initData->properties->setProperty("Ice.Warn.Connections", "0"); + +// +// Limit the send buffer size, this test relies on the socket +// send() blocking after sending a given amount of data. +// +$initData->properties->setProperty("Ice.TCP.SndSize", "50000"); + +$communicator = eval($NS ? "return Ice\\initialize(\$initData);" : + "return Ice_initialize(\$initData);"); + +allTests($communicator); + +exit(); +?> diff --git a/php/test/Ice/slicing/objects/Forward.ice b/php/test/Ice/timeout/Test.ice index 1654e5f10ae..bd242ba4527 100644 --- a/php/test/Ice/slicing/objects/Forward.ice +++ b/php/test/Ice/timeout/Test.ice @@ -1,6 +1,6 @@ // ********************************************************************** // -// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. +// Copyright (c) 2003-2016 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. @@ -12,16 +12,17 @@ module Test { -class Forward; +sequence<byte> ByteSeq; -class Hidden +interface Timeout { - Forward f; -}; + void op(); + void sendData(ByteSeq seq); + void sleep(int to); -class Forward -{ - Hidden h; + void holdAdapter(int to); + + void shutdown(); }; }; diff --git a/php/test/Ice/timeout/msbuild/test.proj b/php/test/Ice/timeout/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Ice/timeout/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Makefile b/php/test/Makefile deleted file mode 100644 index e1b057eaf42..00000000000 --- a/php/test/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = .. - -include $(top_srcdir)/config/Make.rules.php - -SUBDIRS = Ice Slice - -$(EVERYTHING):: - @for subdir in $(SUBDIRS); \ - do \ - echo "making $@ in $$subdir"; \ - ( cd $$subdir && $(MAKE) $@ ) || exit 1; \ - done diff --git a/php/test/Makefile.mak b/php/test/Makefile.mak deleted file mode 100644 index c475e6cb704..00000000000 --- a/php/test/Makefile.mak +++ /dev/null @@ -1,19 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = .. - -!include $(top_srcdir)\config\Make.rules.mak.php - -SUBDIRS = Ice Slice - -$(EVERYTHING):: - @for %i in ( $(SUBDIRS) ) do \ - @echo "making $@ in %i" && \ - cmd /c "cd %i && $(MAKE) -nologo -f Makefile.mak $@" || exit 1 diff --git a/php/test/Slice/Makefile b/php/test/Slice/Makefile deleted file mode 100644 index 18f66acc945..00000000000 --- a/php/test/Slice/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../.. - -include $(top_srcdir)/config/Make.rules.php - -SUBDIRS = keyword structure macros - -$(EVERYTHING):: - @for subdir in $(SUBDIRS); \ - do \ - echo "making $@ in $$subdir"; \ - ( cd $$subdir && $(MAKE) $@ ) || exit 1; \ - done diff --git a/php/test/Slice/Makefile.mak b/php/test/Slice/Makefile.mak deleted file mode 100644 index 28135101bed..00000000000 --- a/php/test/Slice/Makefile.mak +++ /dev/null @@ -1,19 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\.. - -!include $(top_srcdir)\config\Make.rules.mak.php - -SUBDIRS = keyword structure macros - -$(EVERYTHING):: - @for %i in ( $(SUBDIRS) ) do \ - @echo "making $@ in %i" && \ - cmd /c "cd %i && $(MAKE) -nologo -f Makefile.mak $@" || exit 1 diff --git a/php/test/Slice/escape/.gitignore b/php/test/Slice/escape/.gitignore new file mode 100644 index 00000000000..b96188a58b2 --- /dev/null +++ b/php/test/Slice/escape/.gitignore @@ -0,0 +1,2 @@ +Key.php +Clash.php diff --git a/php/test/Slice/escape/Clash.ice b/php/test/Slice/escape/Clash.ice new file mode 100644 index 00000000000..63df89f2e7b --- /dev/null +++ b/php/test/Slice/escape/Clash.ice @@ -0,0 +1,69 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 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. +// +// ********************************************************************** + +[["underscore"]] + +module Clash +{ + +interface Intf +{ + void context(); + void current(); + void response(); + void upCast(); + void typeId(); + void del(); + void cookie(); + void sync(); + void inS(); + void istr(); + + void op(string context, string current, string response, string ex, string sent, string cookie, + string sync, string result, string istr, string ostr, optional(1) string proxy); + void opOut(out string context, out string current, out string response, out string ex, + out string sent, out string cookie, out string sync, out string result, out string istr, + out string ostr, out optional(1) string proxy); +}; + +class Cls +{ + Intf* s; + string context; + int current; + short response; + string upCast; + int typeId; + short del; + optional(1) short cookie; + string ex; + int result; + string istr; + string ostr; + string inS; + string in; + string proxy; +}; + +struct St +{ + string v; + short istr; + int ostr; + int rhs; + string other; +}; + +exception Ex +{ + short istr; + int ostr; +}; + +}; diff --git a/php/test/Slice/keyword/Client.php b/php/test/Slice/escape/Client.php index e9771fe741f..54088ad7f6d 100644 --- a/php/test/Slice/keyword/Client.php +++ b/php/test/Slice/escape/Client.php @@ -1,7 +1,7 @@ -<? +<?php // ********************************************************************** // -// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. +// Copyright (c) 2003-2016 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. @@ -17,14 +17,14 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Key.php'; +require_once('Ice.php'); +require_once('Key.php'); +require_once('Clash.php'); if($NS) { $code = <<<EOT abstract class and_echo extends _and\_echo {} - abstract class and_enddeclare extends _and\_enddeclare {} EOT; eval($code); } @@ -46,21 +46,6 @@ class echoI extends and_echo } } -class enddeclareI extends and_enddeclare -{ - public function _else($a, $b) - { - } - - public function _continue($a, $b) - { - } - - public function _do() - { - } -} - function allTests($communicator) { global $NS; @@ -83,12 +68,9 @@ function allTests($communicator) eval("return and_functionPrxHelper::uncheckedCast(\$p);"); $d = $NS ? eval("return _and\\diePrxHelper::uncheckedCast(\$p);") : eval("return and_diePrxHelper::uncheckedCast(\$p);"); - $e = $NS ? eval("return _and\\echoPrxHelper::uncheckedCast(\$p);") : - eval("return and_echoPrxHelper::uncheckedCast(\$p);"); $e1 = new echoI(); $f = $NS ? eval("return _and\\enddeclarePrxHelper::uncheckedCast(\$p);") : eval("return and_enddeclarePrxHelper::uncheckedCast(\$p);"); - $f1 = new enddeclareI(); $g = $NS ? eval("return new _and\\_endif();") : eval("return new and_endif();"); $h = $NS ? eval("return new _and\\_endwhile();") : eval("return new and_endwhile();"); $i = $NS ? constant("_and\\_or") : constant("and_or"); @@ -97,7 +79,8 @@ function allTests($communicator) echo "ok\n"; } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); allTests($communicator); $communicator->destroy(); diff --git a/php/test/Slice/keyword/Key.ice b/php/test/Slice/escape/Key.ice index 21859cc246a..1444b6e0d66 100644 --- a/php/test/Slice/keyword/Key.ice +++ b/php/test/Slice/escape/Key.ice @@ -1,18 +1,21 @@ // ********************************************************************** // -// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. +// Copyright (c) 2003-2016 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. // // ********************************************************************** +[["underscore"]] + module and { enum array { as }; + struct xor { int abstract; @@ -25,37 +28,51 @@ module and int use; int var; }; + interface break { void case(int catch, out int try); }; + interface function { void continue(int declare, int default); }; + interface die { void do(); }; + class echo { - int if; - void else(die* elseif, out int empty); + int if; + int else; + die* elseif; + int empty; }; - class enddeclare extends echo implements die, function + + interface enddeclare extends die, function { }; sequence<array> endfor; dictionary<string,array> endforeach; - exception endif { int endswitch; }; - exception endwhile extends endif { int eval; int exit; }; + exception endif + { + int endswitch; + }; + + exception endwhile extends endif + { + int eval; + int exit; + }; local interface for { array foreach(break if, echo global, enddeclare require, function* include, - die* return, echo* isset, enddeclare* list, int new, int static) - throws endif, endwhile; + die* return, echo* isset, enddeclare* list, int new, int static) throws endif, endwhile; }; const int or = 0; diff --git a/php/test/Ice/defaultValue/Makefile b/php/test/Slice/escape/Makefile.mk index de41e9ce180..c1c51736ab4 100644 --- a/php/test/Ice/defaultValue/Makefile +++ b/php/test/Slice/escape/Makefile.mk @@ -1,14 +1,10 @@ # ********************************************************************** # -# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. +# Copyright (c) 2003-2016 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. # # ********************************************************************** -top_srcdir = ../../.. - -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php +tests += $(test) diff --git a/php/test/Slice/escape/msbuild/test.proj b/php/test/Slice/escape/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Slice/escape/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Slice/keyword/.depend.mak b/php/test/Slice/keyword/.depend.mak deleted file mode 100644 index 1c84324efb9..00000000000 --- a/php/test/Slice/keyword/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Key.php: \ - Key.ice diff --git a/php/test/Slice/keyword/.gitignore b/php/test/Slice/keyword/.gitignore deleted file mode 100644 index a4492f0fe05..00000000000 --- a/php/test/Slice/keyword/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Key.php diff --git a/php/test/Slice/keyword/Makefile b/php/test/Slice/keyword/Makefile deleted file mode 100644 index d920bbf2119..00000000000 --- a/php/test/Slice/keyword/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = Key.ice - -SLICE2PHPFLAGS = --underscore - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Slice/keyword/Makefile.mak b/php/test/Slice/keyword/Makefile.mak deleted file mode 100644 index 36cd1a7babc..00000000000 --- a/php/test/Slice/keyword/Makefile.mak +++ /dev/null @@ -1,15 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Key.ice -SLICE2PHPFLAGS = --underscore - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Slice/keyword/run.py b/php/test/Slice/keyword/run.py deleted file mode 100755 index c171a3556ce..00000000000 --- a/php/test/Slice/keyword/run.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -testdir = os.getcwd() - -client = os.path.join(testdir, "Client.php") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/php/test/Slice/macros/.depend.mak b/php/test/Slice/macros/.depend.mak deleted file mode 100644 index 4eba865be84..00000000000 --- a/php/test/Slice/macros/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Test.php: \ - Test.ice diff --git a/php/test/Slice/macros/Client.php b/php/test/Slice/macros/Client.php index 601d25adbc8..a364d298319 100644 --- a/php/test/Slice/macros/Client.php +++ b/php/test/Slice/macros/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,9 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; + +require_once('Ice.php'); +require_once('Test.php'); function test($b) { diff --git a/php/test/Slice/macros/Makefile b/php/test/Slice/macros/Makefile deleted file mode 100644 index de41e9ce180..00000000000 --- a/php/test/Slice/macros/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Slice/macros/Makefile.mak b/php/test/Slice/macros/Makefile.mak deleted file mode 100644 index 4ece14f179d..00000000000 --- a/php/test/Slice/macros/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Slice/macros/msbuild/test.proj b/php/test/Slice/macros/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Slice/macros/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Slice/macros/run.py b/php/test/Slice/macros/run.py deleted file mode 100755 index c171a3556ce..00000000000 --- a/php/test/Slice/macros/run.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -testdir = os.getcwd() - -client = os.path.join(testdir, "Client.php") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/php/test/Slice/structure/.depend.mak b/php/test/Slice/structure/.depend.mak deleted file mode 100644 index 4eba865be84..00000000000 --- a/php/test/Slice/structure/.depend.mak +++ /dev/null @@ -1,3 +0,0 @@ - -Test.php: \ - Test.ice diff --git a/php/test/Slice/structure/Client.php b/php/test/Slice/structure/Client.php index 6af50961bdd..f1d271a5bc7 100644 --- a/php/test/Slice/structure/Client.php +++ b/php/test/Slice/structure/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved. @@ -17,8 +17,8 @@ if(!extension_loaded("ice")) } $NS = function_exists("Ice\\initialize"); -require_once ($NS ? 'Ice_ns.php' : 'Ice.php'); -require_once 'Test.php'; +require_once('Ice.php'); +require_once('Test.php'); function test($b) { @@ -226,7 +226,8 @@ function allTests($communicator) echo "ok\n"; } -$communicator = Ice_initialize($argv); +$communicator = $NS ? eval("return Ice\\initialize(\$argv);") : + eval("return Ice_initialize(\$argv);"); allTests($communicator); $communicator->destroy(); diff --git a/php/test/Slice/structure/Makefile b/php/test/Slice/structure/Makefile deleted file mode 100644 index de41e9ce180..00000000000 --- a/php/test/Slice/structure/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ../../.. - -SLICE_SRCS = Test.ice - -include $(top_srcdir)/config/Make.rules.php diff --git a/php/test/Slice/structure/Makefile.mak b/php/test/Slice/structure/Makefile.mak deleted file mode 100644 index a8704fcf2d0..00000000000 --- a/php/test/Slice/structure/Makefile.mak +++ /dev/null @@ -1,14 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -top_srcdir = ..\..\.. - -SLICE_SRCS = Test.ice - -!include $(top_srcdir)\config\Make.rules.mak.php diff --git a/php/test/Slice/structure/msbuild/test.proj b/php/test/Slice/structure/msbuild/test.proj new file mode 100644 index 00000000000..96d0eb928a2 --- /dev/null +++ b/php/test/Slice/structure/msbuild/test.proj @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\..\..\msbuild\ice.tests.props" /> + <Import Project="$(IceBuilderPhpProps)" /> + <ItemGroup> + <IceBuilder Include="..\*.ice" /> + </ItemGroup> + <Import Project="$(IceBuilderPhpTargets)" /> +</Project> diff --git a/php/test/Slice/structure/run.py b/php/test/Slice/structure/run.py deleted file mode 100755 index c171a3556ce..00000000000 --- a/php/test/Slice/structure/run.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2017 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. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -testdir = os.getcwd() - -client = os.path.join(testdir, "Client.php") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() |