helly Wed May 10 21:19:37 2006 UTC Added files: (Branch: PHP_5_2) /php-src/tests/classes abstract_user_call.phpt tostring_001.phpt tostring_002.phpt tostring_003.phpt
Removed files: /php-src/tests/classes interface_construct.phpt tostring.phpt Modified files: /php-src/tests/classes abstract_static.phpt interfaces_003.phpt type_hinting_001.phpt type_hinting_003.phpt Log: - MFH tests
http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/abstract_static.phpt?r1=1.3&r2=1.3.6.1&diff_format=u Index: php-src/tests/classes/abstract_static.phpt diff -u php-src/tests/classes/abstract_static.phpt:1.3 php-src/tests/classes/abstract_static.phpt:1.3.6.1 --- php-src/tests/classes/abstract_static.phpt:1.3 Sat Aug 9 14:48:47 2003 +++ php-src/tests/classes/abstract_static.phpt Wed May 10 21:19:37 2006 @@ -1,21 +1,29 @@ --TEST-- -ZE2 A static abstrcat method may not be called ---SKIPIF-- -<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +ZE2 A static abstrcat methods --FILE-- <?php -abstract class fail { - abstract static function show(); +interface showable +{ + static function show(); } -class pass extends fail { +class pass implements showable +{ static function show() { echo "Call to function show()\n"; } } pass::show(); + +eval(' +class fail +{ + abstract static function func(); +} +'); + fail::show(); echo "Done\n"; // shouldn't be displayed @@ -23,4 +31,4 @@ --EXPECTF-- Call to function show() -Fatal error: Cannot call abstract method fail::show() in %s on line %d +Fatal error: Static function fail::func() cannot be abstract in %s on line %d http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/interfaces_003.phpt?r1=1.1.2.2&r2=1.1.2.2.2.1&diff_format=u Index: php-src/tests/classes/interfaces_003.phpt diff -u php-src/tests/classes/interfaces_003.phpt:1.1.2.2 php-src/tests/classes/interfaces_003.phpt:1.1.2.2.2.1 --- php-src/tests/classes/interfaces_003.phpt:1.1.2.2 Thu Oct 6 18:34:16 2005 +++ php-src/tests/classes/interfaces_003.phpt Wed May 10 21:19:37 2006 @@ -7,27 +7,20 @@ 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 http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/type_hinting_001.phpt?r1=1.3.2.1&r2=1.3.2.1.2.1&diff_format=u Index: php-src/tests/classes/type_hinting_001.phpt diff -u php-src/tests/classes/type_hinting_001.phpt:1.3.2.1 php-src/tests/classes/type_hinting_001.phpt:1.3.2.1.2.1 --- php-src/tests/classes/type_hinting_001.phpt:1.3.2.1 Thu Sep 15 19:49:58 2005 +++ php-src/tests/classes/type_hinting_001.phpt Wed May 10 21:19:37 2006 @@ -35,4 +35,4 @@ ?> --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 http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/type_hinting_003.phpt?r1=1.1.2.2&r2=1.1.2.2.2.1&diff_format=u Index: php-src/tests/classes/type_hinting_003.phpt diff -u php-src/tests/classes/type_hinting_003.phpt:1.1.2.2 php-src/tests/classes/type_hinting_003.phpt:1.1.2.2.2.1 --- php-src/tests/classes/type_hinting_003.phpt:1.1.2.2 Tue Nov 15 21:33:10 2005 +++ php-src/tests/classes/type_hinting_003.phpt Wed May 10 21:19:37 2006 @@ -57,4 +57,4 @@ 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 http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/abstract_user_call.phpt?view=markup&rev=1.1 Index: php-src/tests/classes/abstract_user_call.phpt +++ php-src/tests/classes/abstract_user_call.phpt --TEST-- ZE2 An abstrcat method cannot be called indirectly --FILE-- <?php abstract class test_base { abstract function func(); } class test extends test_base { function func() { echo __METHOD__ . "()\n"; } } $o = new test; $o->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 http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/tostring_001.phpt?view=markup&rev=1.1 Index: php-src/tests/classes/tostring_001.phpt +++ php-src/tests/classes/tostring_001.phpt --TEST-- ZE2 __toString() --SKIPIF-- <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> --FILE-- <?php class test1 { } class test2 { function __toString() { echo __METHOD__ . "()\n"; return "Converted\n"; } } echo "====test1====\n"; $o = new test1; print_r($o); var_dump((string)$o); var_dump($o); echo "====test2====\n"; $o = new test2; print_r($o); print $o; var_dump($o); echo "====test3====\n"; echo $o; echo "====test4====\n"; echo "string:".$o; echo "====test5====\n"; echo 1 . $o; echo 1 . $o; echo "====test6====\n"; echo $o.$o; echo $o,$o; echo "====test7====\n"; $ar = array(); $ar[$o->__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(12) "Object id #%d" object(test1)#%d (0) { } ====test2==== test2 Object ( ) test2::__toString() Converted object(test2)#%d (%d) { } ====test3==== test2::__toString() Converted ====test4==== test2::__toString() string:Converted ====test5==== test2::__toString() 1Converted test2::__toString() 1Converted ====test6==== test2::__toString() test2::__toString() Converted Converted test2::__toString() Converted test2::__toString() Converted ====test7==== test2::__toString() Warning: Illegal offset type in %stostring.php on line %d ====test8==== test2::__toString() string(9) "Converted" test2::__toString() string(9) "Converted" ====test9==== test2::__toString() Converted ====DONE!==== --UEXPECTF-- ====test1==== test1 Object ( ) string(12) "Object id #%d" object(test1)#%d (0) { } ====test2==== test2 Object ( ) test2::__toString() Converted object(test2)#%d (%d) { } ====test3==== test2::__toString() Converted ====test4==== test2::__toString() string:Converted ====test5==== test2::__toString() 1Converted test2::__toString() 1Converted ====test6==== test2::__toString() test2::__toString() Converted Converted test2::__toString() Converted test2::__toString() Converted ====test7==== test2::__toString() Warning: Illegal offset type in %stostring.php on line %d ====test8==== test2::__toString() unicode(9) "Converted" test2::__toString() unicode(9) "Converted" ====test9==== test2::__toString() Converted ====DONE!==== http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/tostring_002.phpt?view=markup&rev=1.1 Index: php-src/tests/classes/tostring_002.phpt +++ php-src/tests/classes/tostring_002.phpt --TEST-- ZE2 __toString() in __destruct --SKIPIF-- <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> --FILE-- <?php class Test { function __toString() { return "Hello\n"; } function __destruct() { echo $this; } } $o = new Test; $o = NULL; $o = new Test; ?> ====DONE==== --EXPECTF-- Hello ====DONE==== Hello http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/tostring_003.phpt?view=markup&rev=1.1 Index: php-src/tests/classes/tostring_003.phpt +++ php-src/tests/classes/tostring_003.phpt --TEST-- ZE2 __toString() in __destruct/exception --SKIPIF-- <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> --FILE-- <?php class Test { function __toString() { throw new Exception("Damn!"); return "Hello\n"; } function __destruct() { echo $this; } } try { $o = new Test; $o = NULL; } catch(Exception $e) { var_dump($e->getMessage()); } ?> ====DONE==== --EXPECTF-- string(5) "Damn!" ====DONE====
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php