summaryrefslogtreecommitdiff
path: root/php/test
diff options
context:
space:
mode:
Diffstat (limited to 'php/test')
-rw-r--r--php/test/Ice/defaultValue/Client.php35
-rw-r--r--php/test/Ice/defaultValue/Test.ice52
2 files changed, 87 insertions, 0 deletions
diff --git a/php/test/Ice/defaultValue/Client.php b/php/test/Ice/defaultValue/Client.php
index eda45edfdeb..b3e9dd7117d 100644
--- a/php/test/Ice/defaultValue/Client.php
+++ b/php/test/Ice/defaultValue/Client.php
@@ -186,6 +186,41 @@ function allTests()
test($v->zeroDotD == 0);
}
echo "ok\n";
+
+ echo "testing default constructor... ";
+ flush();
+ {
+ $v = $NS ? eval("return new Test\\StructNoDefaults;") : eval("return new Test_StructNoDefaults;");
+ $innerStructClass = $NS ? "Test\\InnerStruct" : "Test_InnerStruct";
+ test($v->bo == false);
+ test($v->b == 0);
+ test($v->s == 0);
+ test($v->i == 0);
+ test($v->l == 0);
+ test($v->f == 0.0);
+ test($v->d == 0.0);
+ test($v->str == "");
+ test($v->c1 == $red);
+ test($v->bs == null);
+ test($v->is == null);
+ test($v->dict == null);
+ test($v->st instanceof $innerStructClass);
+
+ $e = $NS ? eval("return new Test\\ExceptionNoDefaults;") : eval("return new Test_ExceptionNoDefaults;");
+ test($e->str == '');
+ test($e->c1 == $red);
+ test($e->bs == null);
+ test($e->st instanceof $innerStructClass);
+ test($e->dict == null);
+
+ $cl = $NS ? eval("return new Test\\ClassNoDefaults;") : eval("return new Test_ClassNoDefaults;");
+ test($cl->str == '');
+ test($cl->c1 == $red);
+ test($cl->bs == null);
+ test($cl->st instanceof $innerStructClass);
+ test($cl->dict == null);
+ }
+ echo "ok\n";
}
allTests();
diff --git a/php/test/Ice/defaultValue/Test.ice b/php/test/Ice/defaultValue/Test.ice
index 37a2f642df2..d9e7f669134 100644
--- a/php/test/Ice/defaultValue/Test.ice
+++ b/php/test/Ice/defaultValue/Test.ice
@@ -152,4 +152,56 @@ exception DerivedEx extends BaseEx
Nested::Color nc3 = ConstNestedColor3;
};
+sequence<byte> ByteSeq;
+sequence<int> IntSeq;
+dictionary<int, string> IntStringDict;
+
+struct InnerStruct
+{
+ int a;
+};
+
+struct StructNoDefaults
+{
+ bool bo;
+ byte b;
+ short s;
+ int i;
+ long l;
+ float f;
+ double d;
+ string str;
+ Color c1;
+ ByteSeq bs;
+ IntSeq is;
+ InnerStruct st;
+ IntStringDict dict;
+};
+
+exception ExceptionNoDefaultsBase
+{
+ string str;
+ Color c1;
+ ByteSeq bs;
+};
+
+exception ExceptionNoDefaults extends ExceptionNoDefaultsBase
+{
+ InnerStruct st;
+ IntStringDict dict;
+};
+
+class ClassNoDefaultsBase
+{
+ string str;
+ Color c1;
+ ByteSeq bs;
+};
+
+class ClassNoDefaults extends ClassNoDefaultsBase
+{
+ InnerStruct st;
+ IntStringDict dict;
+};
+
};