From eb9f2006cc21802d452b51586d7ca4c6956ded27 Mon Sep 17 00:00:00 2001 From: Robin Fernandes Date: Wed, 17 Jun 2009 10:38:24 +0000 Subject: [PATCH] Additional class related tests. --- tests/classes/interface_optional_arg_003.inc | 4 ++ tests/classes/interface_optional_arg_003.phpt | 17 +++++++ tests/classes/iterators_008.phpt | 45 +++++++++++++++++++ .../static_properties_undeclared_assign.phpt | 9 ++++ ...tatic_properties_undeclared_assignInc.phpt | 9 ++++ ...tatic_properties_undeclared_assignRef.phpt | 10 +++++ .../static_properties_undeclared_inc.phpt | 9 ++++ .../static_properties_undeclared_isset.phpt | 9 ++++ .../static_properties_undeclared_read.phpt | 9 ++++ 9 files changed, 121 insertions(+) create mode 100644 tests/classes/interface_optional_arg_003.inc create mode 100644 tests/classes/interface_optional_arg_003.phpt create mode 100644 tests/classes/iterators_008.phpt create mode 100644 tests/classes/static_properties_undeclared_assign.phpt create mode 100644 tests/classes/static_properties_undeclared_assignInc.phpt create mode 100644 tests/classes/static_properties_undeclared_assignRef.phpt create mode 100644 tests/classes/static_properties_undeclared_inc.phpt create mode 100644 tests/classes/static_properties_undeclared_isset.phpt create mode 100644 tests/classes/static_properties_undeclared_read.phpt diff --git a/tests/classes/interface_optional_arg_003.inc b/tests/classes/interface_optional_arg_003.inc new file mode 100644 index 0000000000..a62c65670c --- /dev/null +++ b/tests/classes/interface_optional_arg_003.inc @@ -0,0 +1,4 @@ +f(); +?> +--EXPECTF-- +int(2) \ No newline at end of file diff --git a/tests/classes/iterators_008.phpt b/tests/classes/iterators_008.phpt new file mode 100644 index 0000000000..22e6dc8107 --- /dev/null +++ b/tests/classes/iterators_008.phpt @@ -0,0 +1,45 @@ +--TEST-- +Ensure plain userspace superclass does not override special iterator behaviour on child class. +--FILE-- +counter)\n"; + return $this->counter; + } + + public function next() { + $this->counter--; + echo __METHOD__ . "($this->counter)\n"; + } + + public function rewind() { + echo __METHOD__ . "($this->counter)\n"; + } + + public function current() { + echo __METHOD__ . "($this->counter)\n"; + } + + public function key() { + echo __METHOD__ . "($this->counter)\n"; + } + +} + +foreach (new D as $x) {} +?> +--EXPECTF-- +D::rewind(2) +D::valid(2) +D::current(2) +D::next(1) +D::valid(1) +D::current(1) +D::next(0) +D::valid(0) \ No newline at end of file diff --git a/tests/classes/static_properties_undeclared_assign.phpt b/tests/classes/static_properties_undeclared_assign.phpt new file mode 100644 index 0000000000..99340e9ac5 --- /dev/null +++ b/tests/classes/static_properties_undeclared_assign.phpt @@ -0,0 +1,9 @@ +--TEST-- +Assigning to a non-existent static property +--FILE-- + +--EXPECTF-- +Fatal error: Access to undeclared static property: C::$p in %s on line 3 \ No newline at end of file diff --git a/tests/classes/static_properties_undeclared_assignInc.phpt b/tests/classes/static_properties_undeclared_assignInc.phpt new file mode 100644 index 0000000000..258f2f841b --- /dev/null +++ b/tests/classes/static_properties_undeclared_assignInc.phpt @@ -0,0 +1,9 @@ +--TEST-- +Assigning & incrementing a non-existent static property +--FILE-- + +--EXPECTF-- +Fatal error: Access to undeclared static property: C::$p in %s on line 3 \ No newline at end of file diff --git a/tests/classes/static_properties_undeclared_assignRef.phpt b/tests/classes/static_properties_undeclared_assignRef.phpt new file mode 100644 index 0000000000..75cf270a9a --- /dev/null +++ b/tests/classes/static_properties_undeclared_assignRef.phpt @@ -0,0 +1,10 @@ +--TEST-- +Assigning a non-existent static property by reference +--FILE-- + +--EXPECTF-- +Fatal error: Access to undeclared static property: C::$p in %s on line 4 \ No newline at end of file diff --git a/tests/classes/static_properties_undeclared_inc.phpt b/tests/classes/static_properties_undeclared_inc.phpt new file mode 100644 index 0000000000..ff8b8c3af1 --- /dev/null +++ b/tests/classes/static_properties_undeclared_inc.phpt @@ -0,0 +1,9 @@ +--TEST-- +Incrementing a non-existent static property +--FILE-- + +--EXPECTF-- +Fatal error: Access to undeclared static property: C::$p in %s on line 3 \ No newline at end of file diff --git a/tests/classes/static_properties_undeclared_isset.phpt b/tests/classes/static_properties_undeclared_isset.phpt new file mode 100644 index 0000000000..58aac40052 --- /dev/null +++ b/tests/classes/static_properties_undeclared_isset.phpt @@ -0,0 +1,9 @@ +--TEST-- +Issetting a non-existent static property +--FILE-- + +--EXPECTF-- +bool(false) \ No newline at end of file diff --git a/tests/classes/static_properties_undeclared_read.phpt b/tests/classes/static_properties_undeclared_read.phpt new file mode 100644 index 0000000000..715b41e78d --- /dev/null +++ b/tests/classes/static_properties_undeclared_read.phpt @@ -0,0 +1,9 @@ +--TEST-- +Reading a non-existent static property +--FILE-- + +--EXPECTF-- +Fatal error: Access to undeclared static property: C::$p in %s on line 3 \ No newline at end of file -- 2.50.1