From 9745215cf8910222eb0c828d4cf329c7e9863840 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Wed, 10 May 2006 21:19:37 +0000 Subject: [PATCH] - MFH tests --- tests/classes/abstract_static.phpt | 22 ++- tests/classes/abstract_user_call.phpt | 30 ++++ tests/classes/interface_construct.phpt | 24 ---- tests/classes/interfaces_003.phpt | 13 +- tests/classes/tostring.phpt | 86 ------------ tests/classes/tostring_001.phpt | 184 +++++++++++++++++++++++++ tests/classes/tostring_002.phpt | 31 +++++ tests/classes/tostring_003.phpt | 33 +++++ tests/classes/type_hinting_001.phpt | 2 +- tests/classes/type_hinting_003.phpt | 2 +- 10 files changed, 298 insertions(+), 129 deletions(-) create mode 100755 tests/classes/abstract_user_call.phpt delete mode 100755 tests/classes/interface_construct.phpt delete mode 100644 tests/classes/tostring.phpt create mode 100755 tests/classes/tostring_001.phpt create mode 100755 tests/classes/tostring_002.phpt create mode 100755 tests/classes/tostring_003.phpt diff --git a/tests/classes/abstract_static.phpt b/tests/classes/abstract_static.phpt index 2e46e9dc06d..01f358638bd 100644 --- a/tests/classes/abstract_static.phpt +++ b/tests/classes/abstract_static.phpt @@ -1,21 +1,29 @@ --TEST-- -ZE2 A static abstrcat method may not be called ---SKIPIF-- - +ZE2 A static abstrcat methods --FILE-- func(); + +call_user_func(array($o, 'test_base::func')); + +?> +===DONE=== +--EXPECTF-- +test::func() + +Fatal error: Cannot call abstract method test_base::func() in %s on line %d diff --git a/tests/classes/interface_construct.phpt b/tests/classes/interface_construct.phpt deleted file mode 100755 index 406462e17ad..00000000000 --- a/tests/classes/interface_construct.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -ZE2 An interface constructor signature must not be inherited ---SKIPIF-- - ---FILE-- - ---EXPECT-- -foo - diff --git a/tests/classes/interfaces_003.phpt b/tests/classes/interfaces_003.phpt index 46ae8290aed..2c4c7e7c94f 100755 --- a/tests/classes/interfaces_003.phpt +++ b/tests/classes/interfaces_003.phpt @@ -7,27 +7,20 @@ class MyObject {} interface MyInterface { - public function __construct(Object $o); + public function __construct(MyObject $o); } class MyTestClass implements MyInterface { - public function __construct(Object $o) + public function __construct(MyObject $o) { } } $obj = new MyTestClass; -class MyTestFail -{ - public function __construct() - { - } -} - ?> ===DONE=== --EXPECTF-- -Fatal error: Argument 1 passed to MyTestClass::__construct() must be an object of class Object, called in %sinterfaces_003.php on line %d +Catchable fatal error: Argument 1 passed to MyTestClass::__construct() must be an object of class MyObject, called in %sinterfaces_003.php on line %d diff --git a/tests/classes/tostring.phpt b/tests/classes/tostring.phpt deleted file mode 100644 index 7253cd4c7bc..00000000000 --- a/tests/classes/tostring.phpt +++ /dev/null @@ -1,86 +0,0 @@ ---TEST-- -ZE2 __toString() ---SKIPIF-- - ---FILE-- -__toString()] = "ERROR"; -echo $ar[$o]; - -echo "====test8====\n"; -var_dump(trim($o)); -var_dump(trim((string)$o)); - -echo "====test9====\n"; -echo sprintf("%s", $o); -?> -====DONE!==== ---EXPECTF-- -====test1==== -test1 Object -( -) -string(1%d) "Object id #%d" -object(test1)#%d (%d) { -} -====test2==== -test2 Object -( -) -test2::__toString() -Converted -object(test2)#%d (%d) { -} -====test3==== -test2::__toString() -Converted -====test4==== -string:Object id #%d====test5==== -1Object id #%d====test6==== -Object id #%dObject id #2====test7==== -test2::__toString() - -Warning: Illegal offset type in %stostring.php on line %d -====test8==== - -Notice: Object of class test2 to string conversion in %stostring.php on line %d -string(6) "Object" -string(1%d) "Object id #%d" -====test9==== -Object id #%d====DONE!==== diff --git a/tests/classes/tostring_001.phpt b/tests/classes/tostring_001.phpt new file mode 100755 index 00000000000..a3b2cea194c --- /dev/null +++ b/tests/classes/tostring_001.phpt @@ -0,0 +1,184 @@ +--TEST-- +ZE2 __toString() +--FILE-- +__toString()] = "ERROR"; +echo $ar[$o]; + +echo "====test8====\n"; +var_dump(trim($o)); +var_dump(trim((string)$o)); + +echo "====test9====\n"; +echo sprintf("%s", $o); + +echo "====test10====\n"; +$o = new test3; +var_dump($o); +echo $o; + +?> +====DONE==== +--EXPECTF-- +====test1==== +test1 Object +( +) +string(54) "Object of class test1 could not be converted to string" +string(0) "" +object(test1)#%d (0) { +} +====test2==== +test2 Object +( +) +test2::__toString() +Converted +object(test2)#%d (0) { +} +====test3==== +test2::__toString() +Converted +====test4==== +test2::__toString() +string:Converted +====test5==== +test2::__toString() +1Converted +1test2::__toString() +Converted +====test6==== +test2::__toString() +test2::__toString() +Converted +Converted +test2::__toString() +Converted +test2::__toString() +Converted +====test7==== +test2::__toString() +string(19) "Illegal offset type" +====test8==== +test2::__toString() +string(9) "Converted" +test2::__toString() +string(9) "Converted" +====test9==== +test2::__toString() +Converted +====test10==== +object(test3)#%d (0) { +} +test3::__toString() +string(53) "Method test3::__toString() must return a string value" +====DONE==== +--UEXPECTF-- +====test1==== +test1 Object +( +) +unicode(54) "Object of class test1 could not be converted to string" +unicode(0) "" +object(test1)#%d (0) { +} +====test2==== +test2 Object +( +) +test2::__toString() +Converted +object(test2)#%d (0) { +} +====test3==== +test2::__toString() +Converted +====test4==== +test2::__toString() +string:Converted +====test5==== +test2::__toString() +1Converted +1test2::__toString() +Converted +====test6==== +test2::__toString() +test2::__toString() +Converted +Converted +test2::__toString() +Converted +test2::__toString() +Converted +====test7==== +test2::__toString() +unicode(19) "Illegal offset type" +====test8==== +test2::__toString() +unicode(9) "Converted" +test2::__toString() +unicode(9) "Converted" +====test9==== +test2::__toString() +Converted +====test10==== +object(test3)#%d (0) { +} +test3::__toString() +unicode(53) "Method test3::__toString() must return a string value" +====DONE==== diff --git a/tests/classes/tostring_002.phpt b/tests/classes/tostring_002.phpt new file mode 100755 index 00000000000..8a4a7af3399 --- /dev/null +++ b/tests/classes/tostring_002.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 __toString() in __destruct +--SKIPIF-- + +--FILE-- + +====DONE==== +--EXPECTF-- +Hello +====DONE==== +Hello diff --git a/tests/classes/tostring_003.phpt b/tests/classes/tostring_003.phpt new file mode 100755 index 00000000000..8815bd9407f --- /dev/null +++ b/tests/classes/tostring_003.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 __toString() in __destruct/exception +--FILE-- +getMessage()); +} + +?> +====DONE==== +--EXPECTF-- +Fatal error: Method Test::__toString() must not throw an exception in %stostring_003.php on line %d diff --git a/tests/classes/type_hinting_001.phpt b/tests/classes/type_hinting_001.phpt index 82241298d83..17cf57e3441 100644 --- a/tests/classes/type_hinting_001.phpt +++ b/tests/classes/type_hinting_001.phpt @@ -35,4 +35,4 @@ $a->b($b); ?> --EXPECTF-- -Fatal error: Argument 1 passed to FooBar::a() must implement interface Foo, called in %s on line 27 and defined in %s on line 12 +Catchable fatal error: Argument 1 passed to FooBar::a() must implement interface Foo, called in %s on line 27 and defined in %s on line 12 diff --git a/tests/classes/type_hinting_003.phpt b/tests/classes/type_hinting_003.phpt index 4a83dd41970..ea01fc2dcb1 100755 --- a/tests/classes/type_hinting_003.phpt +++ b/tests/classes/type_hinting_003.phpt @@ -57,4 +57,4 @@ array(1) { int(25) } -Fatal error: Argument 1 passed to Test::f1() must be an array, called in %stype_hinting_003.php on line %d and defined in %stype_hinting_003.php on line %d +Catchable fatal error: Argument 1 passed to Test::f1() must be an array, called in %stype_hinting_003.php on line %d and defined in %stype_hinting_003.php on line %d