diff options
author | Marcus Boerger <helly@php.net> | 2004-08-02 08:29:59 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2004-08-02 08:29:59 +0000 |
commit | 1e6c12c919686a74ea4fb17a9bea5fc231b73035 (patch) | |
tree | 71012c59afea2204d069bca4daea62851c33b647 /tests/classes | |
parent | 5f0433db83663968d20c8ab02b875aad309c544d (diff) | |
download | php-git-1e6c12c919686a74ea4fb17a9bea5fc231b73035.tar.gz |
MFB Enforce protocol of magic methods/classes
Diffstat (limited to 'tests/classes')
-rwxr-xr-x | tests/classes/__call_002.phpt | 15 | ||||
-rwxr-xr-x | tests/classes/__set__get_002.phpt | 14 | ||||
-rwxr-xr-x | tests/classes/__set__get_003.phpt | 14 | ||||
-rwxr-xr-x | tests/classes/destructor_visibility_001.phpt | 24 | ||||
-rwxr-xr-x | tests/classes/destructor_visibility_002.phpt | 24 | ||||
-rwxr-xr-x | tests/classes/destructor_visibility_003.phpt | 28 |
6 files changed, 119 insertions, 0 deletions
diff --git a/tests/classes/__call_002.phpt b/tests/classes/__call_002.phpt new file mode 100755 index 0000000000..53a179f787 --- /dev/null +++ b/tests/classes/__call_002.phpt @@ -0,0 +1,15 @@ +--TEST-- +ZE2 __call() signature check +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php + +class Test { + function __call() { + } +} + +?> +--EXPECTF-- +Fatal error: Method Test::__call() must take exactly 2 arguments in %s__call_002.php on line %d diff --git a/tests/classes/__set__get_002.phpt b/tests/classes/__set__get_002.phpt new file mode 100755 index 0000000000..71111ccdf8 --- /dev/null +++ b/tests/classes/__set__get_002.phpt @@ -0,0 +1,14 @@ +--TEST-- +ZE2 __get() signature check +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php +class Test { + function __get($x,$y) { + } +} + +?> +--EXPECTF-- +Fatal error: Method Test::__get() must take exactly 1 argument in %s__set__get_002.php on line %d diff --git a/tests/classes/__set__get_003.phpt b/tests/classes/__set__get_003.phpt new file mode 100755 index 0000000000..390d303362 --- /dev/null +++ b/tests/classes/__set__get_003.phpt @@ -0,0 +1,14 @@ +--TEST-- +ZE2 __set() signature check +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php +class Test { + function __set() { + } +} + +?> +--EXPECTF-- +Fatal error: Method Test::__set() must take exactly 2 arguments in %s__set__get_003.php on line %d diff --git a/tests/classes/destructor_visibility_001.phpt b/tests/classes/destructor_visibility_001.phpt new file mode 100755 index 0000000000..7674c512f6 --- /dev/null +++ b/tests/classes/destructor_visibility_001.phpt @@ -0,0 +1,24 @@ +--TEST-- +ZE2 Ensuring destructor visibility +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php + +class Base { + private function __destruct() { + echo __METHOD__ . "\n"; + } +} + +class Derived extends Base { +} + +$obj = new Derived; + +unset($obj); + +?> +===DONE=== +--EXPECTF-- +Fatal error: Call to private Derived::__destruct() from context '' in %sdestructor_visibility_001.php on line %d diff --git a/tests/classes/destructor_visibility_002.phpt b/tests/classes/destructor_visibility_002.phpt new file mode 100755 index 0000000000..2cc83334a9 --- /dev/null +++ b/tests/classes/destructor_visibility_002.phpt @@ -0,0 +1,24 @@ +--TEST-- +ZE2 Ensuring destructor visibility +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php + +class Base { + private function __destruct() { + echo __METHOD__ . "\n"; + } +} + +class Derived extends Base { +} + +$obj = new Derived; + +?> +===DONE=== +--EXPECTF-- +===DONE=== + +Warning: Call to private Derived::__destruct() from context '' during shutdown ignored in Unknown on line %d diff --git a/tests/classes/destructor_visibility_003.phpt b/tests/classes/destructor_visibility_003.phpt new file mode 100755 index 0000000000..83e3efe22e --- /dev/null +++ b/tests/classes/destructor_visibility_003.phpt @@ -0,0 +1,28 @@ +--TEST-- +ZE2 Ensuring destructor visibility +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php + +class Base { + private function __destruct() { + echo __METHOD__ . "\n"; + } +} + +class Derived extends Base { + public function __destruct() { + echo __METHOD__ . "\n"; + } +} + +$obj = new Derived; + +unset($obj); // Derived::__destruct is being called not Base::__destruct + +?> +===DONE=== +--EXPECTF-- +Derived::__destruct +===DONE=== |