Testfest test cases for ReflectionExtension

This commit is contained in:
Lars Strojny 2008-06-12 21:25:08 +00:00
parent 5a241ddfe0
commit f2326fbed0
7 changed files with 168 additions and 0 deletions

View file

@ -0,0 +1,15 @@
--TEST--
ReflectionExtension::__construct()
--CREDITS--
Gerrit "Remi" te Sligte <remi@wolerized.com>
Leon Luijkx <leon@phpgg.nl>
--FILE--
<?php
$obj = new ReflectionExtension('reflection');
$test = $obj instanceof ReflectionExtension;
var_dump($test);
?>
==DONE==
--EXPECT--
bool(true)
==DONE==

View file

@ -0,0 +1,16 @@
--TEST--
ReflectionExtension::__construct()
--CREDITS--
Gerrit "Remi" te Sligte <remi@wolerized.com>
Leon Luijkx <leon@phpgg.nl>
--FILE--
<?php
$obj = new ReflectionExtension();
$test = $obj instanceof ReflectionExtension;
var_dump($test);
?>
==DONE==
--EXPECTF--
Warning: ReflectionExtension::__construct() expects exactly %d parameter, %d given in %s.php on line %d
bool(true)
==DONE==

View file

@ -0,0 +1,20 @@
--TEST--
ReflectionExtension::getClassNames() method on an extension which acually returns some information
--CREDITS--
Felix De Vliegher <felix.devliegher@gmail.com>
--FILE--
<?php
$standard = new ReflectionExtension('standard');
var_dump($standard->getClassNames());
?>
==DONE==
--EXPECTF--
array(3) {
[0]=>
%s(22) "__PHP_Incomplete_Class"
[1]=>
%s(15) "php_user_filter"
[2]=>
%s(9) "Directory"
}
==DONE==

View file

@ -0,0 +1,14 @@
--TEST--
ReflectionExtension::getClassNames() method on an extension with no classes
--CREDITS--
Felix De Vliegher <felix.devliegher@gmail.com>
--FILE--
<?php
$ereg = new ReflectionExtension('ereg');
var_dump($ereg->getClassNames());
?>
==DONE==
--EXPECT--
array(0) {
}
==DONE==

View file

@ -0,0 +1,69 @@
--TEST--
ReflectionExtension::getClasses();
--CREDITS--
Thijs Lensselink <tl@lenss.nl>
--FILE--
<?php
$ext = new ReflectionExtension('reflection');
var_dump($ext->getClasses());
?>
==DONE==
--EXPECT--
array(11) {
["ReflectionException"]=>
&object(ReflectionClass)#2 (1) {
["name"]=>
string(19) "ReflectionException"
}
["Reflection"]=>
&object(ReflectionClass)#3 (1) {
["name"]=>
string(10) "Reflection"
}
["Reflector"]=>
&object(ReflectionClass)#4 (1) {
["name"]=>
string(9) "Reflector"
}
["ReflectionFunctionAbstract"]=>
&object(ReflectionClass)#5 (1) {
["name"]=>
string(26) "ReflectionFunctionAbstract"
}
["ReflectionFunction"]=>
&object(ReflectionClass)#6 (1) {
["name"]=>
string(18) "ReflectionFunction"
}
["ReflectionParameter"]=>
&object(ReflectionClass)#7 (1) {
["name"]=>
string(19) "ReflectionParameter"
}
["ReflectionMethod"]=>
&object(ReflectionClass)#8 (1) {
["name"]=>
string(16) "ReflectionMethod"
}
["ReflectionClass"]=>
&object(ReflectionClass)#9 (1) {
["name"]=>
string(15) "ReflectionClass"
}
["ReflectionObject"]=>
&object(ReflectionClass)#10 (1) {
["name"]=>
string(16) "ReflectionObject"
}
["ReflectionProperty"]=>
&object(ReflectionClass)#11 (1) {
["name"]=>
string(18) "ReflectionProperty"
}
["ReflectionExtension"]=>
&object(ReflectionClass)#12 (1) {
["name"]=>
string(19) "ReflectionExtension"
}
}
==DONE==

View file

@ -0,0 +1,18 @@
--TEST--
ReflectionExtension::getDependencies() method on an extension with a required and conflicting dependency
--CREDITS--
Felix De Vliegher <felix.devliegher@gmail.com>
--FILE--
<?php
$dom = new ReflectionExtension('dom');
var_dump($dom->getDependencies());
?>
==DONE==
--EXPECTF--
array(2) {
["libxml"]=>
%s(8) "Required"
["domxml"]=>
%s(9) "Conflicts"
}
==DONE==

View file

@ -0,0 +1,16 @@
--TEST--
ReflectionExtension::getDependencies() method on an extension with one optional dependency
--CREDITS--
Felix De Vliegher <felix.devliegher@gmail.com>
--FILE--
<?php
$standard = new ReflectionExtension('standard');
var_dump($standard->getDependencies());
?>
==DONE==
--EXPECTF--
array(1) {
["session"]=>
%s(8) "Optional"
}
==DONE==