helly Mon Sep 27 15:02:23 2004 EDT
Added files: (Branch: PHP_5_0)
/php-src/tests/reflection .cvsignore bug30146.phpt bug30148.phpt
parameters_001.phpt
Log:
Add new tests
http://cvs.php.net/co.php/php-src/tests/reflection/.cvsignore?r=1.1&p=1
Index: php-src/tests/reflection/.cvsignore
+++ php-src/tests/reflection/.cvsignore
phpt.*
*.diff
*.log
*.exp
*.out
http://cvs.php.net/co.php/php-src/tests/reflection/bug30146.phpt?r=1.1&p=1
Index: php-src/tests/reflection/bug30146.phpt
+++ php-src/tests/reflection/bug30146.phpt
--TEST--
Bug #30146 (ReflectionProperty->getValue() requires instance for static property)
--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===
http://cvs.php.net/co.php/php-src/tests/reflection/bug30148.phpt?r=1.1&p=1
Index: php-src/tests/reflection/bug30148.phpt
+++ php-src/tests/reflection/bug30148.phpt
--TEST--
Bug #30148 (ReflectionMethod->isConstructor() fails for inherited classes)
--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===
http://cvs.php.net/co.php/php-src/tests/reflection/parameters_001.phpt?r=1.1&p=1
Index: php-src/tests/reflection/parameters_001.phpt
+++ php-src/tests/reflection/parameters_001.phpt
--TEST--
invoke with non object or null value
--FILE--
<?php
class Test {
function func($x, $y = NULL){
}
}
$f = new ReflectionMethod('Test', 'func');
$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--
bool(false)
bool(true)
string(54) "The parameter specified by its name could not be found"
===DONE===
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php