From 61de56b7f5dc5590561d9048064ef6c33c905852 Mon Sep 17 00:00:00 2001 From: Jay Smith Date: Fri, 7 Mar 2003 15:56:31 +0000 Subject: [PATCH] Added tests for interfaces and class type hinting. --- tests/classes/interfaces_001.phpt | 26 ++++++++++++++++++++ tests/classes/interfaces_002.phpt | 29 ++++++++++++++++++++++ tests/classes/type_hinting_001.phpt | 38 +++++++++++++++++++++++++++++ tests/lang/type_hints_001.phpt | 26 ++++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 tests/classes/interfaces_001.phpt create mode 100644 tests/classes/interfaces_002.phpt create mode 100644 tests/classes/type_hinting_001.phpt create mode 100644 tests/lang/type_hints_001.phpt 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 -- 2.50.1