cvs: php-src /ext/reflection/tests 001.phpt 002.phpt 004.phpt bug26695.phpt bug29268.phpt bug29523.phpt bug29828.phpt bug30146.phpt bug30148.phpt
bug30856.phpt bug30961.phpt bug33312.phpt bug37964.phpt bug38942.phpt parameters_001.phpt reflectionClass_constructor_002.phpt
reflectionClass_getConstant_basic.phpt
| From: | Sebastian Bergmann | Date: | Sun, 11 May 2008 04:52:42 +0000 |
| Subject: | cvs: php-src /ext/reflection/tests 001.phpt 002.phpt 004.phpt bug26695.phpt bug29268.phpt bug29523.phpt bug29828.phpt bug30146.phpt bug30148.phpt bug30856.phpt bug30961.phpt bug33312.phpt bug37964.phpt bug38942.phpt parameters_001.phpt reflectionClass_constructor_002.phpt reflectionClass_getConstant_basic.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-49921@lists.php.net to get a copy of this message | ||
sebastian Sun May 11 04:52:42 2008 UTC
Modified files:
/php-src/ext/reflection/tests 001.phpt 002.phpt 004.phpt
bug26695.phpt bug29268.phpt
bug29523.phpt bug29828.phpt
bug30146.phpt bug30148.phpt
bug30856.phpt bug30961.phpt
bug33312.phpt bug37964.phpt
bug38942.phpt parameters_001.phpt
reflectionClass_constructor_002.phpt
reflectionClass_getConstant_basic.phpt
Log:
dos2unix *.phpt
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/001.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/reflection/tests/001.phpt diff -u php-src/ext/reflection/tests/001.phpt:1.3 php-src/ext/reflection/tests/001.phpt:1.4 --- php-src/ext/reflection/tests/001.phpt:1.3 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/001.phpt Sun May 11 04:52:42 2008 @@ -1,102 +1,102 @@ ---TEST-- -Reflection inheritance ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class ReflectionClassEx extends ReflectionClass -{ - public $bla; - - function getMethodNames() - { - $res = array(); - foreach($this->getMethods() as $m) - { - $res[] = $m->class . '::' . $m->name; - } - return $res; - } -} - -$r = new ReflectionClassEx('ReflectionClassEx'); - -$exp = array ( - 'UMLClass::__clone', - 'UMLClass::export', - 'UMLClass::__construct', - 'UMLClass::__toString', - 'UMLClass::getName', - 'UMLClass::isInternal', - 'UMLClass::isUserDefined', - 'UMLClass::isInstantiable', - 'UMLClass::getFileName', - 'UMLClass::getStartLine', - 'UMLClass::getEndLine', - 'UMLClass::getDocComment', - 'UMLClass::getConstructor', - 'UMLClass::getMethod', - 'UMLClass::getMethods', - 'UMLClass::getProperty', - 'UMLClass::getProperties', - 'UMLClass::getConstants', - 'UMLClass::getConstant', - 'UMLClass::getInterfaces', - 'UMLClass::isInterface', - 'UMLClass::isAbstract', - 'UMLClass::isFinal', - 'UMLClass::getModifiers', - 'UMLClass::isInstance', - 'UMLClass::newInstance', - 'UMLClass::getParentClass', - 'UMLClass::isSubclassOf', - 'UMLClass::getStaticProperties', - 'UMLClass::getDefaultProperties', - 'UMLClass::isIterateable', - 'UMLClass::implementsInterface', - 'UMLClass::getExtension', - 'UMLClass::getExtensionName'); - -$miss = array(); - -$res = $r->getMethodNames(); - -foreach($exp as $m) -{ - if (!in_array($m, $exp)) - { - $miss[] = $m; - } -} - -var_dump($miss); - -$props = array_keys(get_class_vars('ReflectionClassEx')); -sort($props); -var_dump($props); -var_dump($r->name); -?> -===DONE=== ---EXPECT-- -array(0) { -} -array(2) { - [0]=> - string(3) "bla" - [1]=> - string(4) "name" -} -string(17) "ReflectionClassEx" -===DONE=== ---UEXPECT-- -array(0) { -} -array(2) { - [0]=> - unicode(3) "bla" - [1]=> - unicode(4) "name" -} -unicode(17) "ReflectionClassEx" -===DONE=== +--TEST-- +Reflection inheritance +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class ReflectionClassEx extends ReflectionClass +{ + public $bla; + + function getMethodNames() + { + $res = array(); + foreach($this->getMethods() as $m) + { + $res[] = $m->class . '::' . $m->name; + } + return $res; + } +} + +$r = new ReflectionClassEx('ReflectionClassEx'); + +$exp = array ( + 'UMLClass::__clone', + 'UMLClass::export', + 'UMLClass::__construct', + 'UMLClass::__toString', + 'UMLClass::getName', + 'UMLClass::isInternal', + 'UMLClass::isUserDefined', + 'UMLClass::isInstantiable', + 'UMLClass::getFileName', + 'UMLClass::getStartLine', + 'UMLClass::getEndLine', + 'UMLClass::getDocComment', + 'UMLClass::getConstructor', + 'UMLClass::getMethod', + 'UMLClass::getMethods', + 'UMLClass::getProperty', + 'UMLClass::getProperties', + 'UMLClass::getConstants', + 'UMLClass::getConstant', + 'UMLClass::getInterfaces', + 'UMLClass::isInterface', + 'UMLClass::isAbstract', + 'UMLClass::isFinal', + 'UMLClass::getModifiers', + 'UMLClass::isInstance', + 'UMLClass::newInstance', + 'UMLClass::getParentClass', + 'UMLClass::isSubclassOf', + 'UMLClass::getStaticProperties', + 'UMLClass::getDefaultProperties', + 'UMLClass::isIterateable', + 'UMLClass::implementsInterface', + 'UMLClass::getExtension', + 'UMLClass::getExtensionName'); + +$miss = array(); + +$res = $r->getMethodNames(); + +foreach($exp as $m) +{ + if (!in_array($m, $exp)) + { + $miss[] = $m; + } +} + +var_dump($miss); + +$props = array_keys(get_class_vars('ReflectionClassEx')); +sort($props); +var_dump($props); +var_dump($r->name); +?> +===DONE=== +--EXPECT-- +array(0) { +} +array(2) { + [0]=> + string(3) "bla" + [1]=> + string(4) "name" +} +string(17) "ReflectionClassEx" +===DONE=== +--UEXPECT-- +array(0) { +} +array(2) { + [0]=> + unicode(3) "bla" + [1]=> + unicode(4) "name" +} +unicode(17) "ReflectionClassEx" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/002.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/reflection/tests/002.phpt diff -u php-src/ext/reflection/tests/002.phpt:1.3 php-src/ext/reflection/tests/002.phpt:1.4 --- php-src/ext/reflection/tests/002.phpt:1.3 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/002.phpt Sun May 11 04:52:42 2008 @@ -1,78 +1,78 @@ ---TEST-- -Reflection properties are read only ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class ReflectionMethodEx extends ReflectionMethod -{ - public $foo = "xyz"; - - function __construct($c,$m) - { - echo __METHOD__ . "\n"; - parent::__construct($c,$m); - } -} - -$r = new ReflectionMethodEx('ReflectionMethodEx','getName'); - -var_dump($r->class); -var_dump($r->name); -var_dump($r->foo); -@var_dump($r->bar); - -try -{ - $r->class = 'bullshit'; -} -catch(ReflectionException $e) -{ - echo $e->getMessage() . "\n"; -} -try -{ -$r->name = 'bullshit'; -} -catch(ReflectionException $e) -{ - echo $e->getMessage() . "\n"; -} - -$r->foo = 'bar'; -$r->bar = 'baz'; - -var_dump($r->class); -var_dump($r->name); -var_dump($r->foo); -var_dump($r->bar); - -?> -===DONE=== ---EXPECTF-- -ReflectionMethodEx::__construct -string(18) "ReflectionMethodEx" -string(7) "getName" -string(3) "xyz" -NULL -Cannot set read-only property ReflectionMethodEx::$class -Cannot set read-only property ReflectionMethodEx::$name -string(18) "ReflectionMethodEx" -string(7) "getName" -string(3) "bar" -string(3) "baz" -===DONE=== ---UEXPECTF-- -ReflectionMethodEx::__construct -unicode(18) "ReflectionMethodEx" -unicode(7) "getName" -unicode(3) "xyz" -NULL -Cannot set read-only property ReflectionMethodEx::$class -Cannot set read-only property ReflectionMethodEx::$name -unicode(18) "ReflectionMethodEx" -unicode(7) "getName" -unicode(3) "bar" -unicode(3) "baz" -===DONE=== +--TEST-- +Reflection properties are read only +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class ReflectionMethodEx extends ReflectionMethod +{ + public $foo = "xyz"; + + function __construct($c,$m) + { + echo __METHOD__ . "\n"; + parent::__construct($c,$m); + } +} + +$r = new ReflectionMethodEx('ReflectionMethodEx','getName'); + +var_dump($r->class); +var_dump($r->name); +var_dump($r->foo); +@var_dump($r->bar); + +try +{ + $r->class = 'bullshit'; +} +catch(ReflectionException $e) +{ + echo $e->getMessage() . "\n"; +} +try +{ +$r->name = 'bullshit'; +} +catch(ReflectionException $e) +{ + echo $e->getMessage() . "\n"; +} + +$r->foo = 'bar'; +$r->bar = 'baz'; + +var_dump($r->class); +var_dump($r->name); +var_dump($r->foo); +var_dump($r->bar); + +?> +===DONE=== +--EXPECTF-- +ReflectionMethodEx::__construct +string(18) "ReflectionMethodEx" +string(7) "getName" +string(3) "xyz" +NULL +Cannot set read-only property ReflectionMethodEx::$class +Cannot set read-only property ReflectionMethodEx::$name +string(18) "ReflectionMethodEx" +string(7) "getName" +string(3) "bar" +string(3) "baz" +===DONE=== +--UEXPECTF-- +ReflectionMethodEx::__construct +unicode(18) "ReflectionMethodEx" +unicode(7) "getName" +unicode(3) "xyz" +NULL +Cannot set read-only property ReflectionMethodEx::$class +Cannot set read-only property ReflectionMethodEx::$name +unicode(18) "ReflectionMethodEx" +unicode(7) "getName" +unicode(3) "bar" +unicode(3) "baz" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/004.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/004.phpt diff -u php-src/ext/reflection/tests/004.phpt:1.2 php-src/ext/reflection/tests/004.phpt:1.3 --- php-src/ext/reflection/tests/004.phpt:1.2 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/004.phpt Sun May 11 04:52:42 2008 @@ -1,44 +1,44 @@ ---TEST-- -ReflectionMethod::invoke() with non object or null value ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class a { - function a(){ - } -} -class b { -} - -$b = new b(); - -$a=new ReflectionClass("a"); -$m=$a->getMethod("a"); - -try { - $m->invoke(null); -} catch (ReflectionException $E) { - echo $E->getMessage()."\n"; -} - - -try { - $m->invoke($b); -} catch (ReflectionException $E) { - echo $E->getMessage()."\n"; -} - -$b = new a(); -try { - $m->invoke($b); -} catch (ReflectionException $E) { - echo $E->getMessage()."\n"; -} - -echo "===DONE===\n";?> ---EXPECT-- -Non-object passed to Invoke() -Given object is not an instance of the class this method was declared in -===DONE=== +--TEST-- +ReflectionMethod::invoke() with non object or null value +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class a { + function a(){ + } +} +class b { +} + +$b = new b(); + +$a=new ReflectionClass("a"); +$m=$a->getMethod("a"); + +try { + $m->invoke(null); +} catch (ReflectionException $E) { + echo $E->getMessage()."\n"; +} + + +try { + $m->invoke($b); +} catch (ReflectionException $E) { + echo $E->getMessage()."\n"; +} + +$b = new a(); +try { + $m->invoke($b); +} catch (ReflectionException $E) { + echo $E->getMessage()."\n"; +} + +echo "===DONE===\n";?> +--EXPECT-- +Non-object passed to Invoke() +Given object is not an instance of the class this method was declared in +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug26695.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/reflection/tests/bug26695.phpt diff -u php-src/ext/reflection/tests/bug26695.phpt:1.6 php-src/ext/reflection/tests/bug26695.phpt:1.7 --- php-src/ext/reflection/tests/bug26695.phpt:1.6 Mon Mar 13 22:59:36 2006 +++ php-src/ext/reflection/tests/bug26695.phpt Sun May 11 04:52:42 2008 @@ -1,30 +1,30 @@ ---TEST-- -Reflection Bug #26695 (Reflection API does not recognize mixed-case class hints) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class Foo { -} - -class Bar { - function demo(foo $f) { - } -} - -$class = new ReflectionClass('bar'); -$methods = $class->getMethods(); -$params = $methods[0]->getParameters(); - -$class = $params[0]->getClass(); - -var_dump($class->getName()); -?> -===DONE=== ---EXPECT-- -string(3) "Foo" -===DONE=== ---UEXPECT-- -unicode(3) "Foo" -===DONE=== +--TEST-- +Reflection Bug #26695 (Reflection API does not recognize mixed-case class hints) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class Foo { +} + +class Bar { + function demo(foo $f) { + } +} + +$class = new ReflectionClass('bar'); +$methods = $class->getMethods(); +$params = $methods[0]->getParameters(); + +$class = $params[0]->getClass(); + +var_dump($class->getName()); +?> +===DONE=== +--EXPECT-- +string(3) "Foo" +===DONE=== +--UEXPECT-- +unicode(3) "Foo" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug29268.phpt?r1=1.5&r2=1.6&diff_format=u Index: php-src/ext/reflection/tests/bug29268.phpt diff -u php-src/ext/reflection/tests/bug29268.phpt:1.5 php-src/ext/reflection/tests/bug29268.phpt:1.6 --- php-src/ext/reflection/tests/bug29268.phpt:1.5 Mon Mar 13 22:59:36 2006 +++ php-src/ext/reflection/tests/bug29268.phpt Sun May 11 04:52:42 2008 @@ -1,29 +1,29 @@ ---TEST-- -Reflection Bug #29268 (__autoload() not called with reflectionProperty->getClass()) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -function __autoload($classname) { - echo "__autoload($classname)\n"; - eval("class $classname {}"); -} - -class B{ - public function doit(A $a){ - } -} - -$ref = new reflectionMethod('B','doit'); -$parameters = $ref->getParameters(); -foreach($parameters as $parameter) -{ - $class = $parameter->getClass(); - echo $class->name."\n"; -} -echo "ok\n"; -?> ---EXPECT-- -__autoload(A) -A -ok +--TEST-- +Reflection Bug #29268 (__autoload() not called with reflectionProperty->getClass()) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php +function __autoload($classname) { + echo "__autoload($classname)\n"; + eval("class $classname {}"); +} + +class B{ + public function doit(A $a){ + } +} + +$ref = new reflectionMethod('B','doit'); +$parameters = $ref->getParameters(); +foreach($parameters as $parameter) +{ + $class = $parameter->getClass(); + echo $class->name."\n"; +} +echo "ok\n"; +?> +--EXPECT-- +__autoload(A) +A +ok http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug29523.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/bug29523.phpt diff -u php-src/ext/reflection/tests/bug29523.phpt:1.2 php-src/ext/reflection/tests/bug29523.phpt:1.3 --- php-src/ext/reflection/tests/bug29523.phpt:1.2 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug29523.phpt Sun May 11 04:52:42 2008 @@ -1,40 +1,40 @@ ---TEST-- -Reflection Bug #29523 (ReflectionParameter::isOptional() is incorrect) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class TestClass -{ -} - -function optionalTest(TestClass $a, TestClass $b, $c = 3) -{ -} - -$function = new ReflectionFunction('optionalTest'); -$numberOfNotOptionalParameters = 0; -$numberOfOptionalParameters = 0; -foreach($function->getParameters() as $parameter) -{ - var_dump($parameter->isOptional()); - if ($parameter->isOptional()) - { - ++$numberOfOptionalParameters; - } - else - { - ++$numberOfNotOptionalParameters; - } -} -var_dump($function->getNumberOfRequiredParameters()); -var_dump($numberOfNotOptionalParameters); - -?> ---EXPECT-- -bool(false) -bool(false) -bool(true) -int(2) -int(2) +--TEST-- +Reflection Bug #29523 (ReflectionParameter::isOptional() is incorrect) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class TestClass +{ +} + +function optionalTest(TestClass $a, TestClass $b, $c = 3) +{ +} + +$function = new ReflectionFunction('optionalTest'); +$numberOfNotOptionalParameters = 0; +$numberOfOptionalParameters = 0; +foreach($function->getParameters() as $parameter) +{ + var_dump($parameter->isOptional()); + if ($parameter->isOptional()) + { + ++$numberOfOptionalParameters; + } + else + { + ++$numberOfNotOptionalParameters; + } +} +var_dump($function->getNumberOfRequiredParameters()); +var_dump($numberOfNotOptionalParameters); + +?> +--EXPECT-- +bool(false) +bool(false) +bool(true) +int(2) +int(2) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug29828.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/reflection/tests/bug29828.phpt diff -u php-src/ext/reflection/tests/bug29828.phpt:1.3 php-src/ext/reflection/tests/bug29828.phpt:1.4 --- php-src/ext/reflection/tests/bug29828.phpt:1.3 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug29828.phpt Sun May 11 04:52:42 2008 @@ -1,37 +1,37 @@ ---TEST-- -Reflection Bug #29828 (Interfaces no longer work) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -interface Bla -{ - function bla(); -} - -class BlaMore implements Bla -{ - function bla() - { - echo "Hello\n"; - } -} - -$r = new ReflectionClass('BlaMore'); - -var_dump(count($r->getMethods())); -var_dump($r->getMethod('bla')->isConstructor()); -var_dump($r->getMethod('bla')->isAbstract()); - -$o=new BlaMore; -$o->bla(); - -?> -===DONE=== ---EXPECT-- -int(1) -bool(false) -bool(false) -Hello -===DONE=== +--TEST-- +Reflection Bug #29828 (Interfaces no longer work) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +interface Bla +{ + function bla(); +} + +class BlaMore implements Bla +{ + function bla() + { + echo "Hello\n"; + } +} + +$r = new ReflectionClass('BlaMore'); + +var_dump(count($r->getMethods())); +var_dump($r->getMethod('bla')->isConstructor()); +var_dump($r->getMethod('bla')->isAbstract()); + +$o=new BlaMore; +$o->bla(); + +?> +===DONE=== +--EXPECT-- +int(1) +bool(false) +bool(false) +Hello +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug30146.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/bug30146.phpt diff -u php-src/ext/reflection/tests/bug30146.phpt:1.2 php-src/ext/reflection/tests/bug30146.phpt:1.3 --- php-src/ext/reflection/tests/bug30146.phpt:1.2 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug30146.phpt Sun May 11 04:52:42 2008 @@ -1,25 +1,25 @@ ---TEST-- -Reflection Bug #30146 (ReflectionProperty->getValue() requires instance for static property) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class test { - static public $a = 1; -} - -$r = new ReflectionProperty('test', 'a'); -var_dump($r->getValue(null)); - -$r->setValue(NULL, 2); -var_dump($r->getValue()); - -$r->setValue(3); -var_dump($r->getValue()); -?> -===DONE=== ---EXPECT-- -int(1) -int(2) -int(3) +--TEST-- +Reflection Bug #30146 (ReflectionProperty->getValue() requires instance for static property) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php +class test { + static public $a = 1; +} + +$r = new ReflectionProperty('test', 'a'); +var_dump($r->getValue(null)); + +$r->setValue(NULL, 2); +var_dump($r->getValue()); + +$r->setValue(3); +var_dump($r->getValue()); +?> +===DONE=== +--EXPECT-- +int(1) +int(2) +int(3) ===DONE=== \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug30148.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/bug30148.phpt diff -u php-src/ext/reflection/tests/bug30148.phpt:1.2 php-src/ext/reflection/tests/bug30148.phpt:1.3 --- php-src/ext/reflection/tests/bug30148.phpt:1.2 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug30148.phpt Sun May 11 04:52:42 2008 @@ -1,37 +1,37 @@ ---TEST-- -Reflection Bug #30148 (ReflectionMethod->isConstructor() fails for inherited classes) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class Root -{ - function Root() {} -} -class Base extends Root -{ - function __construct() {} -} -class Derived extends Base -{ -} -$a = new ReflectionMethod('Root','Root'); -$b = new ReflectionMethod('Base','Root'); -$c = new ReflectionMethod('Base','__construct'); -$d = new ReflectionMethod('Derived','Root'); -$e = new ReflectionMethod('Derived','__construct'); -var_dump($a->isConstructor()); -var_dump($b->isConstructor()); -var_dump($c->isConstructor()); -var_dump($d->isConstructor()); -var_dump($e->isConstructor()); -?> -===DONE=== ---EXPECT-- -bool(true) -bool(false) -bool(true) -bool(false) -bool(true) +--TEST-- +Reflection Bug #30148 (ReflectionMethod->isConstructor() fails for inherited classes) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class Root +{ + function Root() {} +} +class Base extends Root +{ + function __construct() {} +} +class Derived extends Base +{ +} +$a = new ReflectionMethod('Root','Root'); +$b = new ReflectionMethod('Base','Root'); +$c = new ReflectionMethod('Base','__construct'); +$d = new ReflectionMethod('Derived','Root'); +$e = new ReflectionMethod('Derived','__construct'); +var_dump($a->isConstructor()); +var_dump($b->isConstructor()); +var_dump($c->isConstructor()); +var_dump($d->isConstructor()); +var_dump($e->isConstructor()); +?> +===DONE=== +--EXPECT-- +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) ===DONE=== \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug30856.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/reflection/tests/bug30856.phpt diff -u php-src/ext/reflection/tests/bug30856.phpt:1.4 php-src/ext/reflection/tests/bug30856.phpt:1.5 --- php-src/ext/reflection/tests/bug30856.phpt:1.4 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug30856.phpt Sun May 11 04:52:42 2008 @@ -1,28 +1,28 @@ ---TEST-- -Reflection Bug #30856 (ReflectionClass::getStaticProperties segfaults) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class bogus { - const C = 'test'; - static $a = bogus::C; -} - -$class = new ReflectionClass('bogus'); - -var_dump($class->getStaticProperties()); -?> -===DONE=== ---EXPECT-- -array(1) { - ["a"]=> - string(4) "test" -} -===DONE=== ---UEXPECT-- -array(1) { - [u"a"]=> - unicode(4) "test" -} -===DONE=== +--TEST-- +Reflection Bug #30856 (ReflectionClass::getStaticProperties segfaults) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php +class bogus { + const C = 'test'; + static $a = bogus::C; +} + +$class = new ReflectionClass('bogus'); + +var_dump($class->getStaticProperties()); +?> +===DONE=== +--EXPECT-- +array(1) { + ["a"]=> + string(4) "test" +} +===DONE=== +--UEXPECT-- +array(1) { + [u"a"]=> + unicode(4) "test" +} +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug30961.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/reflection/tests/bug30961.phpt diff -u php-src/ext/reflection/tests/bug30961.phpt:1.4 php-src/ext/reflection/tests/bug30961.phpt:1.5 --- php-src/ext/reflection/tests/bug30961.phpt:1.4 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug30961.phpt Sun May 11 04:52:42 2008 @@ -1,22 +1,22 @@ ---TEST-- -Reflection Bug #30961 (Wrong linenumber in ReflectionClass getStartLine()) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - class a - { - } - - class b extends a - { - } - - $ref1 = new ReflectionClass('a'); - $ref2 = new ReflectionClass('b'); - echo $ref1->getStartLine() . "\n"; - echo $ref2->getStartLine() . "\n"; -?> ---EXPECT-- -2 -6 +--TEST-- +Reflection Bug #30961 (Wrong linenumber in ReflectionClass getStartLine()) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + class a + { + } + + class b extends a + { + } + + $ref1 = new ReflectionClass('a'); + $ref2 = new ReflectionClass('b'); + echo $ref1->getStartLine() . "\n"; + echo $ref2->getStartLine() . "\n"; +?> +--EXPECT-- +2 +6 http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug33312.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/bug33312.phpt diff -u php-src/ext/reflection/tests/bug33312.phpt:1.2 php-src/ext/reflection/tests/bug33312.phpt:1.3 --- php-src/ext/reflection/tests/bug33312.phpt:1.2 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug33312.phpt Sun May 11 04:52:42 2008 @@ -1,22 +1,22 @@ ---TEST-- -Reflection Bug #33312 (ReflectionParameter methods do not work correctly) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class Foo { - public function bar(Foo $foo, $bar = 'bar') { - } -} - -$class = new ReflectionClass('Foo'); -$method = $class->getMethod('bar'); - -foreach ($method->getParameters() as $parameter) { - if ($parameter->isDefaultValueAvailable()) { - print $parameter->getDefaultValue()."\n"; - } -} -?> ---EXPECT-- -bar +--TEST-- +Reflection Bug #33312 (ReflectionParameter methods do not work correctly) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php +class Foo { + public function bar(Foo $foo, $bar = 'bar') { + } +} + +$class = new ReflectionClass('Foo'); +$method = $class->getMethod('bar'); + +foreach ($method->getParameters() as $parameter) { + if ($parameter->isDefaultValueAvailable()) { + print $parameter->getDefaultValue()."\n"; + } +} +?> +--EXPECT-- +bar http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug37964.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug37964.phpt diff -u php-src/ext/reflection/tests/bug37964.phpt:1.1 php-src/ext/reflection/tests/bug37964.phpt:1.2 --- php-src/ext/reflection/tests/bug37964.phpt:1.1 Wed Jan 16 14:19:07 2008 +++ php-src/ext/reflection/tests/bug37964.phpt Sun May 11 04:52:42 2008 @@ -1,50 +1,50 @@ ---TEST-- -Reflection Bug #37964 (Reflection shows private methods of parent class) ---FILE-- -<?php - -abstract class foobar { - private function test2() { - } -} -class foo extends foobar { - private $foo = 1; - private function test() { - } - protected function test3() { - } -} -class bar extends foo { - private function foobar() { - } -} - -Reflection::export(new ReflectionClass(new bar)); - -?> ---EXPECTF-- -Class [ <user> class bar extends foo ] { - @@ %s %s - - - Constants [0] { - } - - - Static properties [0] { - } - - - Static methods [0] { - } - - - Properties [0] { - } - - - Methods [2] { - Method [ <user> private method foobar ] { - @@ %s %d - %d - } - - Method [ <user, inherits foo> protected method test3 ] { - @@ %s %d - %d - } - } -} +--TEST-- +Reflection Bug #37964 (Reflection shows private methods of parent class) +--FILE-- +<?php + +abstract class foobar { + private function test2() { + } +} +class foo extends foobar { + private $foo = 1; + private function test() { + } + protected function test3() { + } +} +class bar extends foo { + private function foobar() { + } +} + +Reflection::export(new ReflectionClass(new bar)); + +?> +--EXPECTF-- +Class [ <user> class bar extends foo ] { + @@ %s %s + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [2] { + Method [ <user> private method foobar ] { + @@ %s %d - %d + } + + Method [ <user, inherits foo> protected method test3 ] { + @@ %s %d - %d + } + } +} http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38942.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/reflection/tests/bug38942.phpt diff -u php-src/ext/reflection/tests/bug38942.phpt:1.4 php-src/ext/reflection/tests/bug38942.phpt:1.5 --- php-src/ext/reflection/tests/bug38942.phpt:1.4 Thu Apr 12 12:43:54 2007 +++ php-src/ext/reflection/tests/bug38942.phpt Sun May 11 04:52:42 2008 @@ -1,36 +1,36 @@ ---TEST-- -Bug #38942 (Double old-style-ctor inheritance) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class foo { - public function foo() {} -} - -class bar extends foo { -} -ReflectionClass::export("bar"); -?> ---EXPECTF-- -Class [ <user> class bar extends foo ] { - @@ %sbug38942.php 6-7 - - - Constants [0] { - } - - - Static properties [0] { - } - - - Static methods [0] { - } - - - Properties [0] { - } - - - Methods [1] { - Method [ <user, inherits foo, ctor> public method foo ] { - @@ %sbug38942.php 3 - 3 - } - } -} +--TEST-- +Bug #38942 (Double old-style-ctor inheritance) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php +class foo { + public function foo() {} +} + +class bar extends foo { +} +ReflectionClass::export("bar"); +?> +--EXPECTF-- +Class [ <user> class bar extends foo ] { + @@ %sbug38942.php 6-7 + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [1] { + Method [ <user, inherits foo, ctor> public method foo ] { + @@ %sbug38942.php 3 - 3 + } + } +} http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/parameters_001.phpt?r1=1.5&r2=1.6&diff_format=u Index: php-src/ext/reflection/tests/parameters_001.phpt diff -u php-src/ext/reflection/tests/parameters_001.phpt:1.5 php-src/ext/reflection/tests/parameters_001.phpt:1.6 --- php-src/ext/reflection/tests/parameters_001.phpt:1.5 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/parameters_001.phpt Sun May 11 04:52:42 2008 @@ -1,47 +1,47 @@ ---TEST-- -ReflectionParameter Check for parameter being optional ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class Test { - function func($x, $y = NULL){ - } -} - - -$f = new ReflectionMethod('Test', 'func'); -var_dump($f->getNumberOfParameters()); -var_dump($f->getNumberOfRequiredParameters()); - -$p = new ReflectionParameter(array('Test', 'func'), 'x'); -var_dump($p->isOptional()); - -$p = new ReflectionParameter(array('Test', 'func'), 'y'); -var_dump($p->isOptional()); - -try { - $p = new ReflectionParameter(array('Test', 'func'), 'z'); - var_dump($p->isOptional()); -} -catch (Exception $e) { - var_dump($e->getMessage()); -} - -?> -===DONE=== ---EXPECT-- -int(2) -int(1) -bool(false) -bool(true) -string(54) "The parameter specified by its name could not be found" -===DONE=== ---UEXPECT-- -int(2) -int(1) -bool(false) -bool(true) -unicode(54) "The parameter specified by its name could not be found" -===DONE=== +--TEST-- +ReflectionParameter Check for parameter being optional +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class Test { + function func($x, $y = NULL){ + } +} + + +$f = new ReflectionMethod('Test', 'func'); +var_dump($f->getNumberOfParameters()); +var_dump($f->getNumberOfRequiredParameters()); + +$p = new ReflectionParameter(array('Test', 'func'), 'x'); +var_dump($p->isOptional()); + +$p = new ReflectionParameter(array('Test', 'func'), 'y'); +var_dump($p->isOptional()); + +try { + $p = new ReflectionParameter(array('Test', 'func'), 'z'); + var_dump($p->isOptional()); +} +catch (Exception $e) { + var_dump($e->getMessage()); +} + +?> +===DONE=== +--EXPECT-- +int(2) +int(1) +bool(false) +bool(true) +string(54) "The parameter specified by its name could not be found" +===DONE=== +--UEXPECT-- +int(2) +int(1) +bool(false) +bool(true) +unicode(54) "The parameter specified by its name could not be found" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/reflectionClass_constructor_002.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/reflectionClass_constructor_002.phpt diff -u php-src/ext/reflection/tests/reflectionClass_constructor_002.phpt:1.1 php-src/ext/reflection/tests/reflectionClass_constructor_002.phpt:1.2 --- php-src/ext/reflection/tests/reflectionClass_constructor_002.phpt:1.1 Mon Jul 9 13:13:34 2007 +++ php-src/ext/reflection/tests/reflectionClass_constructor_002.phpt Sun May 11 04:52:42 2008 @@ -47,7 +47,7 @@ ?> --EXPECTF-- -Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3 +Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3 object(ReflectionClass)#%d (1) { ["name"]=> string(0) "" @@ -70,7 +70,7 @@ Class X does not exist --UEXPECTF-- -Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3 +Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3 object(ReflectionClass)#%d (1) { [u"name"]=> unicode(0) "" http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/reflectionClass_getConstant_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/reflectionClass_getConstant_basic.phpt diff -u php-src/ext/reflection/tests/reflectionClass_getConstant_basic.phpt:1.1 php-src/ext/reflection/tests/reflectionClass_getConstant_basic.phpt:1.2 --- php-src/ext/reflection/tests/reflectionClass_getConstant_basic.phpt:1.1 Tue Jul 10 16:21:26 2007 +++ php-src/ext/reflection/tests/reflectionClass_getConstant_basic.phpt Sun May 11 04:52:42 2008 @@ -23,7 +23,7 @@ var_dump($rc->getConstant('doesntexist')); } ?> ---EXPECTF-- +--EXPECTF-- Reflecting on class C: string(12) "hello from C" bool(false)
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/001.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/reflection/tests/001.phpt diff -u php-src/ext/reflection/tests/001.phpt:1.3 php-src/ext/reflection/tests/001.phpt:1.4 --- php-src/ext/reflection/tests/001.phpt:1.3 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/001.phpt Sun May 11 04:52:42 2008 @@ -1,102 +1,102 @@ ---TEST-- -Reflection inheritance ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class ReflectionClassEx extends ReflectionClass -{ - public $bla; - - function getMethodNames() - { - $res = array(); - foreach($this->getMethods() as $m) - { - $res[] = $m->class . '::' . $m->name; - } - return $res; - } -} - -$r = new ReflectionClassEx('ReflectionClassEx'); - -$exp = array ( - 'UMLClass::__clone', - 'UMLClass::export', - 'UMLClass::__construct', - 'UMLClass::__toString', - 'UMLClass::getName', - 'UMLClass::isInternal', - 'UMLClass::isUserDefined', - 'UMLClass::isInstantiable', - 'UMLClass::getFileName', - 'UMLClass::getStartLine', - 'UMLClass::getEndLine', - 'UMLClass::getDocComment', - 'UMLClass::getConstructor', - 'UMLClass::getMethod', - 'UMLClass::getMethods', - 'UMLClass::getProperty', - 'UMLClass::getProperties', - 'UMLClass::getConstants', - 'UMLClass::getConstant', - 'UMLClass::getInterfaces', - 'UMLClass::isInterface', - 'UMLClass::isAbstract', - 'UMLClass::isFinal', - 'UMLClass::getModifiers', - 'UMLClass::isInstance', - 'UMLClass::newInstance', - 'UMLClass::getParentClass', - 'UMLClass::isSubclassOf', - 'UMLClass::getStaticProperties', - 'UMLClass::getDefaultProperties', - 'UMLClass::isIterateable', - 'UMLClass::implementsInterface', - 'UMLClass::getExtension', - 'UMLClass::getExtensionName'); - -$miss = array(); - -$res = $r->getMethodNames(); - -foreach($exp as $m) -{ - if (!in_array($m, $exp)) - { - $miss[] = $m; - } -} - -var_dump($miss); - -$props = array_keys(get_class_vars('ReflectionClassEx')); -sort($props); -var_dump($props); -var_dump($r->name); -?> -===DONE=== ---EXPECT-- -array(0) { -} -array(2) { - [0]=> - string(3) "bla" - [1]=> - string(4) "name" -} -string(17) "ReflectionClassEx" -===DONE=== ---UEXPECT-- -array(0) { -} -array(2) { - [0]=> - unicode(3) "bla" - [1]=> - unicode(4) "name" -} -unicode(17) "ReflectionClassEx" -===DONE=== +--TEST-- +Reflection inheritance +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class ReflectionClassEx extends ReflectionClass +{ + public $bla; + + function getMethodNames() + { + $res = array(); + foreach($this->getMethods() as $m) + { + $res[] = $m->class . '::' . $m->name; + } + return $res; + } +} + +$r = new ReflectionClassEx('ReflectionClassEx'); + +$exp = array ( + 'UMLClass::__clone', + 'UMLClass::export', + 'UMLClass::__construct', + 'UMLClass::__toString', + 'UMLClass::getName', + 'UMLClass::isInternal', + 'UMLClass::isUserDefined', + 'UMLClass::isInstantiable', + 'UMLClass::getFileName', + 'UMLClass::getStartLine', + 'UMLClass::getEndLine', + 'UMLClass::getDocComment', + 'UMLClass::getConstructor', + 'UMLClass::getMethod', + 'UMLClass::getMethods', + 'UMLClass::getProperty', + 'UMLClass::getProperties', + 'UMLClass::getConstants', + 'UMLClass::getConstant', + 'UMLClass::getInterfaces', + 'UMLClass::isInterface', + 'UMLClass::isAbstract', + 'UMLClass::isFinal', + 'UMLClass::getModifiers', + 'UMLClass::isInstance', + 'UMLClass::newInstance', + 'UMLClass::getParentClass', + 'UMLClass::isSubclassOf', + 'UMLClass::getStaticProperties', + 'UMLClass::getDefaultProperties', + 'UMLClass::isIterateable', + 'UMLClass::implementsInterface', + 'UMLClass::getExtension', + 'UMLClass::getExtensionName'); + +$miss = array(); + +$res = $r->getMethodNames(); + +foreach($exp as $m) +{ + if (!in_array($m, $exp)) + { + $miss[] = $m; + } +} + +var_dump($miss); + +$props = array_keys(get_class_vars('ReflectionClassEx')); +sort($props); +var_dump($props); +var_dump($r->name); +?> +===DONE=== +--EXPECT-- +array(0) { +} +array(2) { + [0]=> + string(3) "bla" + [1]=> + string(4) "name" +} +string(17) "ReflectionClassEx" +===DONE=== +--UEXPECT-- +array(0) { +} +array(2) { + [0]=> + unicode(3) "bla" + [1]=> + unicode(4) "name" +} +unicode(17) "ReflectionClassEx" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/002.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/reflection/tests/002.phpt diff -u php-src/ext/reflection/tests/002.phpt:1.3 php-src/ext/reflection/tests/002.phpt:1.4 --- php-src/ext/reflection/tests/002.phpt:1.3 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/002.phpt Sun May 11 04:52:42 2008 @@ -1,78 +1,78 @@ ---TEST-- -Reflection properties are read only ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class ReflectionMethodEx extends ReflectionMethod -{ - public $foo = "xyz"; - - function __construct($c,$m) - { - echo __METHOD__ . "\n"; - parent::__construct($c,$m); - } -} - -$r = new ReflectionMethodEx('ReflectionMethodEx','getName'); - -var_dump($r->class); -var_dump($r->name); -var_dump($r->foo); -@var_dump($r->bar); - -try -{ - $r->class = 'bullshit'; -} -catch(ReflectionException $e) -{ - echo $e->getMessage() . "\n"; -} -try -{ -$r->name = 'bullshit'; -} -catch(ReflectionException $e) -{ - echo $e->getMessage() . "\n"; -} - -$r->foo = 'bar'; -$r->bar = 'baz'; - -var_dump($r->class); -var_dump($r->name); -var_dump($r->foo); -var_dump($r->bar); - -?> -===DONE=== ---EXPECTF-- -ReflectionMethodEx::__construct -string(18) "ReflectionMethodEx" -string(7) "getName" -string(3) "xyz" -NULL -Cannot set read-only property ReflectionMethodEx::$class -Cannot set read-only property ReflectionMethodEx::$name -string(18) "ReflectionMethodEx" -string(7) "getName" -string(3) "bar" -string(3) "baz" -===DONE=== ---UEXPECTF-- -ReflectionMethodEx::__construct -unicode(18) "ReflectionMethodEx" -unicode(7) "getName" -unicode(3) "xyz" -NULL -Cannot set read-only property ReflectionMethodEx::$class -Cannot set read-only property ReflectionMethodEx::$name -unicode(18) "ReflectionMethodEx" -unicode(7) "getName" -unicode(3) "bar" -unicode(3) "baz" -===DONE=== +--TEST-- +Reflection properties are read only +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class ReflectionMethodEx extends ReflectionMethod +{ + public $foo = "xyz"; + + function __construct($c,$m) + { + echo __METHOD__ . "\n"; + parent::__construct($c,$m); + } +} + +$r = new ReflectionMethodEx('ReflectionMethodEx','getName'); + +var_dump($r->class); +var_dump($r->name); +var_dump($r->foo); +@var_dump($r->bar); + +try +{ + $r->class = 'bullshit'; +} +catch(ReflectionException $e) +{ + echo $e->getMessage() . "\n"; +} +try +{ +$r->name = 'bullshit'; +} +catch(ReflectionException $e) +{ + echo $e->getMessage() . "\n"; +} + +$r->foo = 'bar'; +$r->bar = 'baz'; + +var_dump($r->class); +var_dump($r->name); +var_dump($r->foo); +var_dump($r->bar); + +?> +===DONE=== +--EXPECTF-- +ReflectionMethodEx::__construct +string(18) "ReflectionMethodEx" +string(7) "getName" +string(3) "xyz" +NULL +Cannot set read-only property ReflectionMethodEx::$class +Cannot set read-only property ReflectionMethodEx::$name +string(18) "ReflectionMethodEx" +string(7) "getName" +string(3) "bar" +string(3) "baz" +===DONE=== +--UEXPECTF-- +ReflectionMethodEx::__construct +unicode(18) "ReflectionMethodEx" +unicode(7) "getName" +unicode(3) "xyz" +NULL +Cannot set read-only property ReflectionMethodEx::$class +Cannot set read-only property ReflectionMethodEx::$name +unicode(18) "ReflectionMethodEx" +unicode(7) "getName" +unicode(3) "bar" +unicode(3) "baz" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/004.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/004.phpt diff -u php-src/ext/reflection/tests/004.phpt:1.2 php-src/ext/reflection/tests/004.phpt:1.3 --- php-src/ext/reflection/tests/004.phpt:1.2 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/004.phpt Sun May 11 04:52:42 2008 @@ -1,44 +1,44 @@ ---TEST-- -ReflectionMethod::invoke() with non object or null value ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class a { - function a(){ - } -} -class b { -} - -$b = new b(); - -$a=new ReflectionClass("a"); -$m=$a->getMethod("a"); - -try { - $m->invoke(null); -} catch (ReflectionException $E) { - echo $E->getMessage()."\n"; -} - - -try { - $m->invoke($b); -} catch (ReflectionException $E) { - echo $E->getMessage()."\n"; -} - -$b = new a(); -try { - $m->invoke($b); -} catch (ReflectionException $E) { - echo $E->getMessage()."\n"; -} - -echo "===DONE===\n";?> ---EXPECT-- -Non-object passed to Invoke() -Given object is not an instance of the class this method was declared in -===DONE=== +--TEST-- +ReflectionMethod::invoke() with non object or null value +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class a { + function a(){ + } +} +class b { +} + +$b = new b(); + +$a=new ReflectionClass("a"); +$m=$a->getMethod("a"); + +try { + $m->invoke(null); +} catch (ReflectionException $E) { + echo $E->getMessage()."\n"; +} + + +try { + $m->invoke($b); +} catch (ReflectionException $E) { + echo $E->getMessage()."\n"; +} + +$b = new a(); +try { + $m->invoke($b); +} catch (ReflectionException $E) { + echo $E->getMessage()."\n"; +} + +echo "===DONE===\n";?> +--EXPECT-- +Non-object passed to Invoke() +Given object is not an instance of the class this method was declared in +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug26695.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/reflection/tests/bug26695.phpt diff -u php-src/ext/reflection/tests/bug26695.phpt:1.6 php-src/ext/reflection/tests/bug26695.phpt:1.7 --- php-src/ext/reflection/tests/bug26695.phpt:1.6 Mon Mar 13 22:59:36 2006 +++ php-src/ext/reflection/tests/bug26695.phpt Sun May 11 04:52:42 2008 @@ -1,30 +1,30 @@ ---TEST-- -Reflection Bug #26695 (Reflection API does not recognize mixed-case class hints) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class Foo { -} - -class Bar { - function demo(foo $f) { - } -} - -$class = new ReflectionClass('bar'); -$methods = $class->getMethods(); -$params = $methods[0]->getParameters(); - -$class = $params[0]->getClass(); - -var_dump($class->getName()); -?> -===DONE=== ---EXPECT-- -string(3) "Foo" -===DONE=== ---UEXPECT-- -unicode(3) "Foo" -===DONE=== +--TEST-- +Reflection Bug #26695 (Reflection API does not recognize mixed-case class hints) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class Foo { +} + +class Bar { + function demo(foo $f) { + } +} + +$class = new ReflectionClass('bar'); +$methods = $class->getMethods(); +$params = $methods[0]->getParameters(); + +$class = $params[0]->getClass(); + +var_dump($class->getName()); +?> +===DONE=== +--EXPECT-- +string(3) "Foo" +===DONE=== +--UEXPECT-- +unicode(3) "Foo" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug29268.phpt?r1=1.5&r2=1.6&diff_format=u Index: php-src/ext/reflection/tests/bug29268.phpt diff -u php-src/ext/reflection/tests/bug29268.phpt:1.5 php-src/ext/reflection/tests/bug29268.phpt:1.6 --- php-src/ext/reflection/tests/bug29268.phpt:1.5 Mon Mar 13 22:59:36 2006 +++ php-src/ext/reflection/tests/bug29268.phpt Sun May 11 04:52:42 2008 @@ -1,29 +1,29 @@ ---TEST-- -Reflection Bug #29268 (__autoload() not called with reflectionProperty->getClass()) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -function __autoload($classname) { - echo "__autoload($classname)\n"; - eval("class $classname {}"); -} - -class B{ - public function doit(A $a){ - } -} - -$ref = new reflectionMethod('B','doit'); -$parameters = $ref->getParameters(); -foreach($parameters as $parameter) -{ - $class = $parameter->getClass(); - echo $class->name."\n"; -} -echo "ok\n"; -?> ---EXPECT-- -__autoload(A) -A -ok +--TEST-- +Reflection Bug #29268 (__autoload() not called with reflectionProperty->getClass()) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php +function __autoload($classname) { + echo "__autoload($classname)\n"; + eval("class $classname {}"); +} + +class B{ + public function doit(A $a){ + } +} + +$ref = new reflectionMethod('B','doit'); +$parameters = $ref->getParameters(); +foreach($parameters as $parameter) +{ + $class = $parameter->getClass(); + echo $class->name."\n"; +} +echo "ok\n"; +?> +--EXPECT-- +__autoload(A) +A +ok http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug29523.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/bug29523.phpt diff -u php-src/ext/reflection/tests/bug29523.phpt:1.2 php-src/ext/reflection/tests/bug29523.phpt:1.3 --- php-src/ext/reflection/tests/bug29523.phpt:1.2 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug29523.phpt Sun May 11 04:52:42 2008 @@ -1,40 +1,40 @@ ---TEST-- -Reflection Bug #29523 (ReflectionParameter::isOptional() is incorrect) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class TestClass -{ -} - -function optionalTest(TestClass $a, TestClass $b, $c = 3) -{ -} - -$function = new ReflectionFunction('optionalTest'); -$numberOfNotOptionalParameters = 0; -$numberOfOptionalParameters = 0; -foreach($function->getParameters() as $parameter) -{ - var_dump($parameter->isOptional()); - if ($parameter->isOptional()) - { - ++$numberOfOptionalParameters; - } - else - { - ++$numberOfNotOptionalParameters; - } -} -var_dump($function->getNumberOfRequiredParameters()); -var_dump($numberOfNotOptionalParameters); - -?> ---EXPECT-- -bool(false) -bool(false) -bool(true) -int(2) -int(2) +--TEST-- +Reflection Bug #29523 (ReflectionParameter::isOptional() is incorrect) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class TestClass +{ +} + +function optionalTest(TestClass $a, TestClass $b, $c = 3) +{ +} + +$function = new ReflectionFunction('optionalTest'); +$numberOfNotOptionalParameters = 0; +$numberOfOptionalParameters = 0; +foreach($function->getParameters() as $parameter) +{ + var_dump($parameter->isOptional()); + if ($parameter->isOptional()) + { + ++$numberOfOptionalParameters; + } + else + { + ++$numberOfNotOptionalParameters; + } +} +var_dump($function->getNumberOfRequiredParameters()); +var_dump($numberOfNotOptionalParameters); + +?> +--EXPECT-- +bool(false) +bool(false) +bool(true) +int(2) +int(2) http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug29828.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/reflection/tests/bug29828.phpt diff -u php-src/ext/reflection/tests/bug29828.phpt:1.3 php-src/ext/reflection/tests/bug29828.phpt:1.4 --- php-src/ext/reflection/tests/bug29828.phpt:1.3 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug29828.phpt Sun May 11 04:52:42 2008 @@ -1,37 +1,37 @@ ---TEST-- -Reflection Bug #29828 (Interfaces no longer work) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -interface Bla -{ - function bla(); -} - -class BlaMore implements Bla -{ - function bla() - { - echo "Hello\n"; - } -} - -$r = new ReflectionClass('BlaMore'); - -var_dump(count($r->getMethods())); -var_dump($r->getMethod('bla')->isConstructor()); -var_dump($r->getMethod('bla')->isAbstract()); - -$o=new BlaMore; -$o->bla(); - -?> -===DONE=== ---EXPECT-- -int(1) -bool(false) -bool(false) -Hello -===DONE=== +--TEST-- +Reflection Bug #29828 (Interfaces no longer work) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +interface Bla +{ + function bla(); +} + +class BlaMore implements Bla +{ + function bla() + { + echo "Hello\n"; + } +} + +$r = new ReflectionClass('BlaMore'); + +var_dump(count($r->getMethods())); +var_dump($r->getMethod('bla')->isConstructor()); +var_dump($r->getMethod('bla')->isAbstract()); + +$o=new BlaMore; +$o->bla(); + +?> +===DONE=== +--EXPECT-- +int(1) +bool(false) +bool(false) +Hello +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug30146.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/bug30146.phpt diff -u php-src/ext/reflection/tests/bug30146.phpt:1.2 php-src/ext/reflection/tests/bug30146.phpt:1.3 --- php-src/ext/reflection/tests/bug30146.phpt:1.2 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug30146.phpt Sun May 11 04:52:42 2008 @@ -1,25 +1,25 @@ ---TEST-- -Reflection Bug #30146 (ReflectionProperty->getValue() requires instance for static property) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class test { - static public $a = 1; -} - -$r = new ReflectionProperty('test', 'a'); -var_dump($r->getValue(null)); - -$r->setValue(NULL, 2); -var_dump($r->getValue()); - -$r->setValue(3); -var_dump($r->getValue()); -?> -===DONE=== ---EXPECT-- -int(1) -int(2) -int(3) +--TEST-- +Reflection Bug #30146 (ReflectionProperty->getValue() requires instance for static property) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php +class test { + static public $a = 1; +} + +$r = new ReflectionProperty('test', 'a'); +var_dump($r->getValue(null)); + +$r->setValue(NULL, 2); +var_dump($r->getValue()); + +$r->setValue(3); +var_dump($r->getValue()); +?> +===DONE=== +--EXPECT-- +int(1) +int(2) +int(3) ===DONE=== \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug30148.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/bug30148.phpt diff -u php-src/ext/reflection/tests/bug30148.phpt:1.2 php-src/ext/reflection/tests/bug30148.phpt:1.3 --- php-src/ext/reflection/tests/bug30148.phpt:1.2 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug30148.phpt Sun May 11 04:52:42 2008 @@ -1,37 +1,37 @@ ---TEST-- -Reflection Bug #30148 (ReflectionMethod->isConstructor() fails for inherited classes) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class Root -{ - function Root() {} -} -class Base extends Root -{ - function __construct() {} -} -class Derived extends Base -{ -} -$a = new ReflectionMethod('Root','Root'); -$b = new ReflectionMethod('Base','Root'); -$c = new ReflectionMethod('Base','__construct'); -$d = new ReflectionMethod('Derived','Root'); -$e = new ReflectionMethod('Derived','__construct'); -var_dump($a->isConstructor()); -var_dump($b->isConstructor()); -var_dump($c->isConstructor()); -var_dump($d->isConstructor()); -var_dump($e->isConstructor()); -?> -===DONE=== ---EXPECT-- -bool(true) -bool(false) -bool(true) -bool(false) -bool(true) +--TEST-- +Reflection Bug #30148 (ReflectionMethod->isConstructor() fails for inherited classes) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class Root +{ + function Root() {} +} +class Base extends Root +{ + function __construct() {} +} +class Derived extends Base +{ +} +$a = new ReflectionMethod('Root','Root'); +$b = new ReflectionMethod('Base','Root'); +$c = new ReflectionMethod('Base','__construct'); +$d = new ReflectionMethod('Derived','Root'); +$e = new ReflectionMethod('Derived','__construct'); +var_dump($a->isConstructor()); +var_dump($b->isConstructor()); +var_dump($c->isConstructor()); +var_dump($d->isConstructor()); +var_dump($e->isConstructor()); +?> +===DONE=== +--EXPECT-- +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) ===DONE=== \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug30856.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/reflection/tests/bug30856.phpt diff -u php-src/ext/reflection/tests/bug30856.phpt:1.4 php-src/ext/reflection/tests/bug30856.phpt:1.5 --- php-src/ext/reflection/tests/bug30856.phpt:1.4 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug30856.phpt Sun May 11 04:52:42 2008 @@ -1,28 +1,28 @@ ---TEST-- -Reflection Bug #30856 (ReflectionClass::getStaticProperties segfaults) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class bogus { - const C = 'test'; - static $a = bogus::C; -} - -$class = new ReflectionClass('bogus'); - -var_dump($class->getStaticProperties()); -?> -===DONE=== ---EXPECT-- -array(1) { - ["a"]=> - string(4) "test" -} -===DONE=== ---UEXPECT-- -array(1) { - [u"a"]=> - unicode(4) "test" -} -===DONE=== +--TEST-- +Reflection Bug #30856 (ReflectionClass::getStaticProperties segfaults) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php +class bogus { + const C = 'test'; + static $a = bogus::C; +} + +$class = new ReflectionClass('bogus'); + +var_dump($class->getStaticProperties()); +?> +===DONE=== +--EXPECT-- +array(1) { + ["a"]=> + string(4) "test" +} +===DONE=== +--UEXPECT-- +array(1) { + [u"a"]=> + unicode(4) "test" +} +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug30961.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/reflection/tests/bug30961.phpt diff -u php-src/ext/reflection/tests/bug30961.phpt:1.4 php-src/ext/reflection/tests/bug30961.phpt:1.5 --- php-src/ext/reflection/tests/bug30961.phpt:1.4 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug30961.phpt Sun May 11 04:52:42 2008 @@ -1,22 +1,22 @@ ---TEST-- -Reflection Bug #30961 (Wrong linenumber in ReflectionClass getStartLine()) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - class a - { - } - - class b extends a - { - } - - $ref1 = new ReflectionClass('a'); - $ref2 = new ReflectionClass('b'); - echo $ref1->getStartLine() . "\n"; - echo $ref2->getStartLine() . "\n"; -?> ---EXPECT-- -2 -6 +--TEST-- +Reflection Bug #30961 (Wrong linenumber in ReflectionClass getStartLine()) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + class a + { + } + + class b extends a + { + } + + $ref1 = new ReflectionClass('a'); + $ref2 = new ReflectionClass('b'); + echo $ref1->getStartLine() . "\n"; + echo $ref2->getStartLine() . "\n"; +?> +--EXPECT-- +2 +6 http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug33312.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/reflection/tests/bug33312.phpt diff -u php-src/ext/reflection/tests/bug33312.phpt:1.2 php-src/ext/reflection/tests/bug33312.phpt:1.3 --- php-src/ext/reflection/tests/bug33312.phpt:1.2 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/bug33312.phpt Sun May 11 04:52:42 2008 @@ -1,22 +1,22 @@ ---TEST-- -Reflection Bug #33312 (ReflectionParameter methods do not work correctly) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class Foo { - public function bar(Foo $foo, $bar = 'bar') { - } -} - -$class = new ReflectionClass('Foo'); -$method = $class->getMethod('bar'); - -foreach ($method->getParameters() as $parameter) { - if ($parameter->isDefaultValueAvailable()) { - print $parameter->getDefaultValue()."\n"; - } -} -?> ---EXPECT-- -bar +--TEST-- +Reflection Bug #33312 (ReflectionParameter methods do not work correctly) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php +class Foo { + public function bar(Foo $foo, $bar = 'bar') { + } +} + +$class = new ReflectionClass('Foo'); +$method = $class->getMethod('bar'); + +foreach ($method->getParameters() as $parameter) { + if ($parameter->isDefaultValueAvailable()) { + print $parameter->getDefaultValue()."\n"; + } +} +?> +--EXPECT-- +bar http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug37964.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/bug37964.phpt diff -u php-src/ext/reflection/tests/bug37964.phpt:1.1 php-src/ext/reflection/tests/bug37964.phpt:1.2 --- php-src/ext/reflection/tests/bug37964.phpt:1.1 Wed Jan 16 14:19:07 2008 +++ php-src/ext/reflection/tests/bug37964.phpt Sun May 11 04:52:42 2008 @@ -1,50 +1,50 @@ ---TEST-- -Reflection Bug #37964 (Reflection shows private methods of parent class) ---FILE-- -<?php - -abstract class foobar { - private function test2() { - } -} -class foo extends foobar { - private $foo = 1; - private function test() { - } - protected function test3() { - } -} -class bar extends foo { - private function foobar() { - } -} - -Reflection::export(new ReflectionClass(new bar)); - -?> ---EXPECTF-- -Class [ <user> class bar extends foo ] { - @@ %s %s - - - Constants [0] { - } - - - Static properties [0] { - } - - - Static methods [0] { - } - - - Properties [0] { - } - - - Methods [2] { - Method [ <user> private method foobar ] { - @@ %s %d - %d - } - - Method [ <user, inherits foo> protected method test3 ] { - @@ %s %d - %d - } - } -} +--TEST-- +Reflection Bug #37964 (Reflection shows private methods of parent class) +--FILE-- +<?php + +abstract class foobar { + private function test2() { + } +} +class foo extends foobar { + private $foo = 1; + private function test() { + } + protected function test3() { + } +} +class bar extends foo { + private function foobar() { + } +} + +Reflection::export(new ReflectionClass(new bar)); + +?> +--EXPECTF-- +Class [ <user> class bar extends foo ] { + @@ %s %s + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [2] { + Method [ <user> private method foobar ] { + @@ %s %d - %d + } + + Method [ <user, inherits foo> protected method test3 ] { + @@ %s %d - %d + } + } +} http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug38942.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/reflection/tests/bug38942.phpt diff -u php-src/ext/reflection/tests/bug38942.phpt:1.4 php-src/ext/reflection/tests/bug38942.phpt:1.5 --- php-src/ext/reflection/tests/bug38942.phpt:1.4 Thu Apr 12 12:43:54 2007 +++ php-src/ext/reflection/tests/bug38942.phpt Sun May 11 04:52:42 2008 @@ -1,36 +1,36 @@ ---TEST-- -Bug #38942 (Double old-style-ctor inheritance) ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php -class foo { - public function foo() {} -} - -class bar extends foo { -} -ReflectionClass::export("bar"); -?> ---EXPECTF-- -Class [ <user> class bar extends foo ] { - @@ %sbug38942.php 6-7 - - - Constants [0] { - } - - - Static properties [0] { - } - - - Static methods [0] { - } - - - Properties [0] { - } - - - Methods [1] { - Method [ <user, inherits foo, ctor> public method foo ] { - @@ %sbug38942.php 3 - 3 - } - } -} +--TEST-- +Bug #38942 (Double old-style-ctor inheritance) +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php +class foo { + public function foo() {} +} + +class bar extends foo { +} +ReflectionClass::export("bar"); +?> +--EXPECTF-- +Class [ <user> class bar extends foo ] { + @@ %sbug38942.php 6-7 + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [1] { + Method [ <user, inherits foo, ctor> public method foo ] { + @@ %sbug38942.php 3 - 3 + } + } +} http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/parameters_001.phpt?r1=1.5&r2=1.6&diff_format=u Index: php-src/ext/reflection/tests/parameters_001.phpt diff -u php-src/ext/reflection/tests/parameters_001.phpt:1.5 php-src/ext/reflection/tests/parameters_001.phpt:1.6 --- php-src/ext/reflection/tests/parameters_001.phpt:1.5 Sun Mar 12 12:11:22 2006 +++ php-src/ext/reflection/tests/parameters_001.phpt Sun May 11 04:52:42 2008 @@ -1,47 +1,47 @@ ---TEST-- -ReflectionParameter Check for parameter being optional ---SKIPIF-- -<?php extension_loaded('reflection') or die('skip'); ?> ---FILE-- -<?php - -class Test { - function func($x, $y = NULL){ - } -} - - -$f = new ReflectionMethod('Test', 'func'); -var_dump($f->getNumberOfParameters()); -var_dump($f->getNumberOfRequiredParameters()); - -$p = new ReflectionParameter(array('Test', 'func'), 'x'); -var_dump($p->isOptional()); - -$p = new ReflectionParameter(array('Test', 'func'), 'y'); -var_dump($p->isOptional()); - -try { - $p = new ReflectionParameter(array('Test', 'func'), 'z'); - var_dump($p->isOptional()); -} -catch (Exception $e) { - var_dump($e->getMessage()); -} - -?> -===DONE=== ---EXPECT-- -int(2) -int(1) -bool(false) -bool(true) -string(54) "The parameter specified by its name could not be found" -===DONE=== ---UEXPECT-- -int(2) -int(1) -bool(false) -bool(true) -unicode(54) "The parameter specified by its name could not be found" -===DONE=== +--TEST-- +ReflectionParameter Check for parameter being optional +--SKIPIF-- +<?php extension_loaded('reflection') or die('skip'); ?> +--FILE-- +<?php + +class Test { + function func($x, $y = NULL){ + } +} + + +$f = new ReflectionMethod('Test', 'func'); +var_dump($f->getNumberOfParameters()); +var_dump($f->getNumberOfRequiredParameters()); + +$p = new ReflectionParameter(array('Test', 'func'), 'x'); +var_dump($p->isOptional()); + +$p = new ReflectionParameter(array('Test', 'func'), 'y'); +var_dump($p->isOptional()); + +try { + $p = new ReflectionParameter(array('Test', 'func'), 'z'); + var_dump($p->isOptional()); +} +catch (Exception $e) { + var_dump($e->getMessage()); +} + +?> +===DONE=== +--EXPECT-- +int(2) +int(1) +bool(false) +bool(true) +string(54) "The parameter specified by its name could not be found" +===DONE=== +--UEXPECT-- +int(2) +int(1) +bool(false) +bool(true) +unicode(54) "The parameter specified by its name could not be found" +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/reflectionClass_constructor_002.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/reflectionClass_constructor_002.phpt diff -u php-src/ext/reflection/tests/reflectionClass_constructor_002.phpt:1.1 php-src/ext/reflection/tests/reflectionClass_constructor_002.phpt:1.2 --- php-src/ext/reflection/tests/reflectionClass_constructor_002.phpt:1.1 Mon Jul 9 13:13:34 2007 +++ php-src/ext/reflection/tests/reflectionClass_constructor_002.phpt Sun May 11 04:52:42 2008 @@ -47,7 +47,7 @@ ?> --EXPECTF-- -Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3 +Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3 object(ReflectionClass)#%d (1) { ["name"]=> string(0) "" @@ -70,7 +70,7 @@ Class X does not exist --UEXPECTF-- -Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3 +Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3 object(ReflectionClass)#%d (1) { [u"name"]=> unicode(0) "" http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/reflectionClass_getConstant_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/reflection/tests/reflectionClass_getConstant_basic.phpt diff -u php-src/ext/reflection/tests/reflectionClass_getConstant_basic.phpt:1.1 php-src/ext/reflection/tests/reflectionClass_getConstant_basic.phpt:1.2 --- php-src/ext/reflection/tests/reflectionClass_getConstant_basic.phpt:1.1 Tue Jul 10 16:21:26 2007 +++ php-src/ext/reflection/tests/reflectionClass_getConstant_basic.phpt Sun May 11 04:52:42 2008 @@ -23,7 +23,7 @@ var_dump($rc->getConstant('doesntexist')); } ?> ---EXPECTF-- +--EXPECTF-- Reflecting on class C: string(12) "hello from C" bool(false)