From: Jay Smith Date: Fri, 7 Mar 2003 15:56:31 +0000 (+0000) Subject: Added tests for interfaces and class type hinting. X-Git-Tag: RELEASE_0_5~561 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61de56b7f5dc5590561d9048064ef6c33c905852;p=php Added tests for interfaces and class type hinting. --- diff --git a/tests/classes/interfaces_001.phpt b/tests/classes/interfaces_001.phpt new file mode 100644 index 0000000000..e65074d830 --- /dev/null +++ b/tests/classes/interfaces_001.phpt @@ -0,0 +1,26 @@ +--TEST-- +ZE2 interfaces +--SKIPIF-- + +--FILE-- +foo; + } +} + +$foo = new Exception; +echo $foo->getMessage() . "\n"; + +?> +--EXPECT-- +foo + diff --git a/tests/classes/interfaces_002.phpt b/tests/classes/interfaces_002.phpt new file mode 100644 index 0000000000..309dd76cec --- /dev/null +++ b/tests/classes/interfaces_002.phpt @@ -0,0 +1,29 @@ +--TEST-- +ZE2 interface with an unimplemented method +--SKIPIF-- + +--FILE-- +foo; + } +} + +// this should die -- Exception class must be abstract... +$foo = new Exception; +echo $foo->getMessage() . "\n"; + +?> +--EXPECTF-- + +Fatal error: Class exception contains abstract methods and must be declared abstract in %s on line %d + diff --git a/tests/classes/type_hinting_001.phpt b/tests/classes/type_hinting_001.phpt new file mode 100644 index 0000000000..e6b97a5873 --- /dev/null +++ b/tests/classes/type_hinting_001.phpt @@ -0,0 +1,38 @@ +--TEST-- +ZE2 class type hinting +--SKIPIF-- + +--FILE-- +a($b); +$a->b($b); + +?> +--EXPECTF-- + +Fatal error: Argument 1 must implement interface foo in %s on line %d diff --git a/tests/lang/type_hints_001.phpt b/tests/lang/type_hints_001.phpt new file mode 100644 index 0000000000..bd1577fe31 --- /dev/null +++ b/tests/lang/type_hints_001.phpt @@ -0,0 +1,26 @@ +--TEST-- +ZE2 type hinting +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Fatal error: Argument 1 must be an instance of foo in %s on line %d