Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/tests/classes/ is_a.phpt
Alan, Can you look at is_a_error_001.phpt and is_subclass_of_error_001.phpt in PHP_5_3? These are now diffing: http://gcov.php.net/viewer.php?version=PHP_5_3func=tests Thanks, Chris On 09/23/2011 06:18 PM, Alan Knowles wrote: alan_k Sat, 24 Sep 2011 01:18:29 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317226 Log: add is_a and is_subclass_of test with autoloader feature Its a bit of an overkill, but should ensure breaks are easier to spot in future. Changed paths: A php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/tests/classes/ is_a.phpt
Should be fixed now Regards Alan --- On 27/Sep/2011, Christopher Jones wrote: Alan, Can you look at is_a_error_001.phpt and is_subclass_of_error_001.phpt in PHP_5_3? These are now diffing: http://gcov.php.net/viewer.php?version=PHP_5_3func=tests Thanks, Chris On 09/23/2011 06:18 PM, Alan Knowles wrote: alan_k Sat, 24 Sep 2011 01:18:29 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317226 Log: add is_a and is_subclass_of test with autoloader feature Its a bit of an overkill, but should ensure breaks are easier to spot in future. Changed paths: A php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/tests/classes/ is_a.phpt
Thanks for adding the test! Chris On 9/23/11 6:18 PM, Alan Knowles wrote: alan_k Sat, 24 Sep 2011 01:18:29 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317226 Log: add is_a and is_subclass_of test with autoloader feature Its a bit of an overkill, but should ensure breaks are easier to spot in future. Changed paths: A php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/tests/classes/ is_a.phpt
On Sat, Sep 24, 2011 at 03:18, Alan Knowles ala...@php.net wrote: alan_k Sat, 24 Sep 2011 01:18:29 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317226 Log: add is_a and is_subclass_of test with autoloader feature Its a bit of an overkill, but should ensure breaks are easier to spot in future. Changed paths: A php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt Isn't it needed for 5.4 trunk/ too? -Hannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/tests/classes/ is_a.phpt
It needs some concensus on the plan for 5.4 really. - just posting to internals about that soon. On Saturday, September 24, 2011 06:57 PM, Hannes Magnusson wrote: On Sat, Sep 24, 2011 at 03:18, Alan Knowlesala...@php.net wrote: alan_k Sat, 24 Sep 2011 01:18:29 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317226 Log: add is_a and is_subclass_of test with autoloader feature Its a bit of an overkill, but should ensure breaks are easier to spot in future. Changed paths: A php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt Isn't it needed for 5.4 trunk/ too? -Hannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/tests/classes/ is_a.phpt
alan_k Sat, 24 Sep 2011 01:18:29 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317226 Log: add is_a and is_subclass_of test with autoloader feature Its a bit of an overkill, but should ensure breaks are easier to spot in future. Changed paths: A php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt Added: php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt === --- php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt 2011-09-24 01:18:29 UTC (rev 317226) @@ -0,0 +1,707 @@ +--TEST-- +is_a and is_subclass_behaviour +--SKIPIF-- +?php if (version_compare(zend_version(), '2.0.0-dev', '')) die('skip ZendEngine 2 needed'); ? +--FILE-- +?php + +interface if_a { + function f_a(); +} + +interface if_b extends if_a { + function f_b(); +} + +class base { + function _is_a($sub) { + + echo \n With Defined class\n; + echo str_pad('is_a( OBJECT:'.get_class($this).', '.$sub.') = ', 60) . (is_a($this, $sub) ? 'yes' : 'no').\n; + echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_a(get_class($this), $sub) ? 'yes' : 'no').\n; + echo str_pad('is_subclass_of( OBJECT:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of($this, $sub) ? 'yes' : 'no').\n; + echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of(get_class($this), $sub) ? 'yes' : 'no').\n; + + // with autoload options.. + echo With Undefined\n; + echo str_pad('is_a( STRING:undefB, '.$sub.',true) = ', 60). (is_a('undefB', $sub, true) ? 'yes' : 'no').\n; + echo str_pad('is_a( STRING:undefB, '.$sub.') = ', 60). (is_a('undefB', $sub) ? 'yes' : 'no').\n; + echo str_pad('is_subclass_of( STRING:undefB, '.$sub.',false) = ', 60). (is_subclass_of('undefB', $sub, false) ? 'yes' : 'no').\n; + echo str_pad('is_subclass_of( STRING:undefB, '.$sub.') = ', 60). (is_subclass_of('undefB', $sub) ? 'yes' : 'no').\n; + } + function test() { + echo $this-_is_a('base'); + echo $this-_is_a('derived_a'); + echo $this-_is_a('derived_b'); + echo $this-_is_a('derived_c'); + echo $this-_is_a('derived_d'); + echo $this-_is_a('if_a'); + echo $this-_is_a('if_b'); + echo $this-_is_a('undefA'); + echo \n; + } +} + +class derived_a extends base implements if_a { + function f_a() {} +} + +class derived_b extends base implements if_a, if_b { + function f_a() {} + function f_b() {} +} + +class derived_c extends derived_a implements if_b { + function f_b() {} +} + +class derived_d extends derived_c { +} + +$t = new base(); +$t-test(); +eval(' + function __autoload($name) + { + echo In __autoload: ; + var_dump($name); + } +'); + +echo NOW WITH AUTOLOAD\n\n; + +$t = new base(); +$t-test(); + +$t = new derived_a(); +$t-test(); + +$t = new derived_b(); +$t-test(); + +$t = new derived_c(); +$t-test(); + +$t = new derived_d(); +$t-test(); + + + + + +? +--EXPECTF-- + With Defined class +is_a( OBJECT:base, base) = yes +is_a( STRING:base, base) = no +is_subclass_of( OBJECT:base, base) =no +is_subclass_of( STRING:base, base) =no + With Undefined +is_a( STRING:undefB, base,true) = no +is_a( STRING:undefB, base) =no +is_subclass_of( STRING:undefB, base,false) =no +is_subclass_of( STRING:undefB, base) = no + + With Defined class +is_a( OBJECT:base, derived_a) = no +is_a( STRING:base, derived_a) = no +is_subclass_of( OBJECT:base, derived_a) = no +is_subclass_of( STRING:base, derived_a) = no + With Undefined +is_a( STRING:undefB, derived_a,true) = no +is_a( STRING:undefB, derived_a) = no +is_subclass_of( STRING:undefB, derived_a,false) = no +is_subclass_of( STRING:undefB, derived_a) = no + + With Defined class +is_a( OBJECT:base, derived_b) = no +is_a( STRING:base, derived_b) = no +is_subclass_of( OBJECT:base, derived_b) = no +is_subclass_of( STRING:base, derived_b) = no + With Undefined +is_a( STRING:undefB, derived_b,true) = no +is_a( STRING:undefB, derived_b) = no +is_subclass_of( STRING:undefB, derived_b,false) = no +is_subclass_of( STRING:undefB, derived_b) = no + + With Defined class +is_a( OBJECT:base, derived_c) = no +is_a( STRING:base, derived_c) = no +is_subclass_of( OBJECT:base, derived_c) = no +is_subclass_of( STRING:base, derived_c) = no + With Undefined +is_a( STRING:undefB,
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/tests/classes/ is_a.phpt
alan_k Sat, 24 Sep 2011 01:29:48 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317227 Log: clean up is_a test, so that it covers more use cases - negative and positive testing Changed paths: U php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt Modified: php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt === --- php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt 2011-09-24 01:18:29 UTC (rev 317226) +++ php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt 2011-09-24 01:29:48 UTC (rev 317227) @@ -19,9 +19,11 @@ echo \n With Defined class\n; echo str_pad('is_a( OBJECT:'.get_class($this).', '.$sub.') = ', 60) . (is_a($this, $sub) ? 'yes' : 'no').\n; echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_a(get_class($this), $sub) ? 'yes' : 'no').\n; + echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.', true) = ', 60). (is_a(get_class($this), $sub, true) ? 'yes' : 'no').\n; echo str_pad('is_subclass_of( OBJECT:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of($this, $sub) ? 'yes' : 'no').\n; echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of(get_class($this), $sub) ? 'yes' : 'no').\n; - + echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.',false) = ', 60). (is_subclass_of(get_class($this), $sub , false) ? 'yes' : 'no').\n; + // with autoload options.. echo With Undefined\n; echo str_pad('is_a( STRING:undefB, '.$sub.',true) = ', 60). (is_a('undefB', $sub, true) ? 'yes' : 'no').\n; @@ -31,12 +33,8 @@ } function test() { echo $this-_is_a('base'); - echo $this-_is_a('derived_a'); - echo $this-_is_a('derived_b'); - echo $this-_is_a('derived_c'); - echo $this-_is_a('derived_d'); - echo $this-_is_a('if_a'); - echo $this-_is_a('if_b'); + echo $this-_is_a('derived_a'); + echo $this-_is_a('if_a'); echo $this-_is_a('undefA'); echo \n; } @@ -60,6 +58,10 @@ $t = new base(); $t-test(); + +$t = new derived_a(); +$t-test(); + eval(' function __autoload($name) { @@ -78,24 +80,20 @@ $t = new derived_b(); $t-test(); + -$t = new derived_c(); -$t-test(); -$t = new derived_d(); -$t-test(); - - - ? --EXPECTF-- With Defined class is_a( OBJECT:base, base) = yes is_a( STRING:base, base) = no +is_a( STRING:base, base, true) =yes is_subclass_of( OBJECT:base, base) =no is_subclass_of( STRING:base, base) =no +is_subclass_of( STRING:base, base,false) = no With Undefined is_a( STRING:undefB, base,true) = no is_a( STRING:undefB, base) =no @@ -105,8 +103,10 @@ With Defined class is_a( OBJECT:base, derived_a) = no is_a( STRING:base, derived_a) = no +is_a( STRING:base, derived_a, true) = no is_subclass_of( OBJECT:base, derived_a) = no is_subclass_of( STRING:base, derived_a) = no +is_subclass_of( STRING:base, derived_a,false) = no With Undefined is_a( STRING:undefB, derived_a,true) = no is_a( STRING:undefB, derived_a) = no @@ -114,66 +114,79 @@ is_subclass_of( STRING:undefB, derived_a) = no With Defined class -is_a( OBJECT:base, derived_b) = no -is_a( STRING:base, derived_b) = no -is_subclass_of( OBJECT:base, derived_b) = no -is_subclass_of( STRING:base, derived_b) = no +is_a( OBJECT:base, if_a) = no +is_a( STRING:base, if_a) = no +is_a( STRING:base, if_a, true) =no +is_subclass_of( OBJECT:base, if_a) =no +is_subclass_of( STRING:base, if_a) =no +is_subclass_of( STRING:base, if_a,false) = no With Undefined -is_a( STRING:undefB, derived_b,true) = no -is_a( STRING:undefB, derived_b) = no -is_subclass_of( STRING:undefB, derived_b,false) = no -is_subclass_of( STRING:undefB, derived_b) = no +is_a( STRING:undefB, if_a,true) = no +is_a( STRING:undefB, if_a) =no +is_subclass_of( STRING:undefB, if_a,false) =no +is_subclass_of( STRING:undefB, if_a) = no With Defined class -is_a( OBJECT:base, derived_c) = no -is_a( STRING:base, derived_c) = no -is_subclass_of( OBJECT:base, derived_c) = no -is_subclass_of( STRING:base, derived_c) = no +is_a(
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/tests/classes/ is_a.phpt
alan_k Sat, 24 Sep 2011 01:34:46 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317228 Log: clean up is_a test title Changed paths: U php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt Modified: php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt === --- php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt2011-09-24 01:29:48 UTC (rev 317227) +++ php/php-src/branches/PHP_5_3/tests/classes/is_a.phpt2011-09-24 01:34:46 UTC (rev 317228) @@ -1,5 +1,5 @@ --TEST-- -is_a and is_subclass_behaviour +is_a and is_subclass_of behaviour (with and without autoload) --SKIPIF-- ?php if (version_compare(zend_version(), '2.0.0-dev', '')) die('skip ZendEngine 2 needed'); ? --FILE-- -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php