diff options
author | Steve Seear <stevseea@php.net> | 2008-03-19 17:56:10 +0000 |
---|---|---|
committer | Steve Seear <stevseea@php.net> | 2008-03-19 17:56:10 +0000 |
commit | 6e361fa7db07a2835993b23565c92e3b8dbfab4d (patch) | |
tree | 0451043099745d0ba64d716e313f8f0a23c7d920 /tests/classes | |
parent | 4c2b3336a21a2601cfd0169ac3069d5ccf93bf1e (diff) | |
download | php-git-6e361fa7db07a2835993b23565c92e3b8dbfab4d.tar.gz |
Added some class tests; Replaced some hardcoded instance ids with %d.
Diffstat (limited to 'tests/classes')
-rwxr-xr-x | tests/classes/array_access_009.phpt | 8 | ||||
-rwxr-xr-x | tests/classes/array_access_010.phpt | 8 | ||||
-rwxr-xr-x | tests/classes/array_access_011.phpt | 8 | ||||
-rw-r--r-- | tests/classes/interface_optional_arg_002.phpt | 24 | ||||
-rw-r--r-- | tests/classes/method_override_optional_arg_001.phpt | 33 | ||||
-rw-r--r-- | tests/classes/method_override_optional_arg_002.phpt | 22 |
6 files changed, 91 insertions, 12 deletions
diff --git a/tests/classes/array_access_009.phpt b/tests/classes/array_access_009.phpt index f77dd7bfc5..3862240261 100755 --- a/tests/classes/array_access_009.phpt +++ b/tests/classes/array_access_009.phpt @@ -129,9 +129,9 @@ string(6) "FooBar" string(9) "FooBarBaz" ===ArrayOverloading=== ArrayProxy::__construct(0) -object(ArrayProxy)#1 (2) { +object(ArrayProxy)#%d (2) { ["object":"ArrayProxy":private]=> - object(Peoples)#2 (1) { + object(Peoples)#%d (1) { ["person"]=> array(1) { [0]=> @@ -166,9 +166,9 @@ string(12) "FooBarBarBaz" ArrayProxy::__construct(0) ArrayProxy::offsetUnset(0, name) ArrayProxy::__construct(0) -object(ArrayProxy)#1 (2) { +object(ArrayProxy)#%d (2) { ["object":"ArrayProxy":private]=> - object(Peoples)#2 (1) { + object(Peoples)#%d (1) { ["person"]=> array(1) { [0]=> diff --git a/tests/classes/array_access_010.phpt b/tests/classes/array_access_010.phpt index f655217953..e60716dc1b 100755 --- a/tests/classes/array_access_010.phpt +++ b/tests/classes/array_access_010.phpt @@ -103,9 +103,9 @@ string(6) "FooBar" string(9) "FooBarBaz" ===ArrayOverloading=== ArrayReferenceProxy::__construct(Array) -object(ArrayReferenceProxy)#1 (2) { +object(ArrayReferenceProxy)#%d (2) { ["object":"ArrayReferenceProxy":private]=> - object(Peoples)#2 (1) { + object(Peoples)#%d (1) { ["person"]=> array(1) { [0]=> @@ -143,9 +143,9 @@ string(12) "FooBarBarBaz" ArrayReferenceProxy::__construct(Array) ArrayReferenceProxy::offsetUnset(Array, name) ArrayReferenceProxy::__construct(Array) -object(ArrayReferenceProxy)#1 (2) { +object(ArrayReferenceProxy)#%d (2) { ["object":"ArrayReferenceProxy":private]=> - object(Peoples)#2 (1) { + object(Peoples)#%d (1) { ["person"]=> array(1) { [0]=> diff --git a/tests/classes/array_access_011.phpt b/tests/classes/array_access_011.phpt index 1242edb8af..aa20a56d39 100755 --- a/tests/classes/array_access_011.phpt +++ b/tests/classes/array_access_011.phpt @@ -112,9 +112,9 @@ string(6) "FooBar" string(9) "FooBarBaz" ===ArrayOverloading=== ArrayAccessReferenceProxy::__construct(0) -object(ArrayAccessReferenceProxy)#1 (3) { +object(ArrayAccessReferenceProxy)#%d (3) { ["object":"ArrayAccessReferenceProxy":private]=> - object(Peoples)#2 (1) { + object(Peoples)#%d (1) { ["person"]=> &array(1) { [0]=> @@ -157,9 +157,9 @@ string(12) "FooBarBarBaz" ArrayAccessReferenceProxy::__construct(0) ArrayAccessReferenceProxy::offsetUnset(0, name) ArrayAccessReferenceProxy::__construct(0) -object(ArrayAccessReferenceProxy)#1 (3) { +object(ArrayAccessReferenceProxy)#%d (3) { ["object":"ArrayAccessReferenceProxy":private]=> - object(Peoples)#2 (1) { + object(Peoples)#%d (1) { ["person"]=> &array(1) { [0]=> diff --git a/tests/classes/interface_optional_arg_002.phpt b/tests/classes/interface_optional_arg_002.phpt new file mode 100644 index 0000000000..92980f65b4 --- /dev/null +++ b/tests/classes/interface_optional_arg_002.phpt @@ -0,0 +1,24 @@ +--TEST-- +default argument value in interface implementation +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php + +interface test { + public function bar(); +} + +class foo implements test { + + public function bar($arg = 2) { + var_dump($arg); + } +} + +$foo = new foo; +$foo->bar(); + +?> +--EXPECT-- +int(2)
\ No newline at end of file diff --git a/tests/classes/method_override_optional_arg_001.phpt b/tests/classes/method_override_optional_arg_001.phpt new file mode 100644 index 0000000000..53272fff73 --- /dev/null +++ b/tests/classes/method_override_optional_arg_001.phpt @@ -0,0 +1,33 @@ +--TEST-- +Method override allows optional default argument +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php + +class A { + function foo($arg1 = 1) { + } +} + +class B extends A { + function foo($arg1 = 2, $arg2 = 3) { + var_dump($arg1); + var_dump($arg2); + } +} + +class C extends A { + function foo() { + } +} + +$b = new B(); + +$b->foo(1); + +?> +--EXPECTF-- +Strict Standards: Declaration of C::foo() should be compatible with that of A::foo() in %s on line %d +int(1) +int(3) diff --git a/tests/classes/method_override_optional_arg_002.phpt b/tests/classes/method_override_optional_arg_002.phpt new file mode 100644 index 0000000000..c212b8260d --- /dev/null +++ b/tests/classes/method_override_optional_arg_002.phpt @@ -0,0 +1,22 @@ +--TEST-- +Omitting optional arg in method inherited from abstract class +--FILE-- +<?php + +abstract class A { + function foo($arg = 1) {} +} + +class B extends A { + function foo() { + echo "foo\n"; + } +} + +$b = new B(); +$b->foo(); + +?> +--EXPECTF-- +Strict Standards: Declaration of B::foo() should be compatible with that of A::foo() in %s on line %d +foo |