1
0
mirror of https://github.com/php/php-src.git synced 2026-04-09 09:03:04 +02:00
Files
archived-php-src/ext/reflection/tests/reflectionClass_hasMethod_basic.phpt
2008-05-23 21:14:05 +00:00

60 lines
1.1 KiB
PHP

--TEST--
ReflectionClass::hasMethod()
--SKIPIF--
<?php extension_loaded('reflection') or die('skip - reflection extension not loaded'); ?>
--CREDITS--
Marc Veldman <marc@ibuildings.nl>
#testfest roosendaal on 2008-05-10
--FILE--
<?php
//New instance of class C - defined below
$rc = new ReflectionClass("C");
//Check if C has public method publicFoo
var_dump($rc->hasMethod('publicFoo'));
//Check if C has protected method protectedFoo
var_dump($rc->hasMethod('protectedFoo'));
//Check if C has private method privateFoo
var_dump($rc->hasMethod('privateFoo'));
//Check if C has static method staticFoo
var_dump($rc->hasMethod('staticFoo'));
//C should not have method bar
var_dump($rc->hasMethod('bar'));
//Method names are case insensitive
var_dump($rc->hasMethod('PUBLICfOO'));
Class C {
public function publicFoo()
{
return true;
}
protected function protectedFoo()
{
return true;
}
private function privateFoo()
{
return true;
}
static function staticFoo()
{
return true;
}
}
?>
--EXPECTF--
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
bool(true)