felipe          Mon Aug 11 14:00:03 2008 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/reflection/tests       010.phpt 011.phpt 012.phpt 013.phpt 
                                        014.phpt 015.phpt 016.phpt 017.phpt 
                                        018.phpt 019.phpt 020.phpt 021.phpt 
                                        022.phpt 023.phpt 024.phpt 025.phpt 
  Log:
  - MFH: New tests
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/010.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/010.phpt
+++ php-src/ext/reflection/tests/010.phpt
--TEST--
ReflectionMethod::__toString() tests (overriden method)
--FILE--
<?php
class Foo {
        function func() {
        }
}
class Bar extends Foo {
        function func() {
        }
}
$m = new ReflectionMethod("Bar::func");
echo $m;
?>
--EXPECTF--     
Method [ <user, overwrites Foo, prototype Foo> public method func ] {
  @@ %s010.php 7 - 8
}

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/011.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/011.phpt
+++ php-src/ext/reflection/tests/011.phpt
--TEST--
ReflectionExtension::getClasses()
--FILE--
<?php
$ext = new ReflectionExtension("reflection");
$classes = $ext->getClasses();
echo $classes["ReflectionException"]->getName();
?>
--EXPECT--      
ReflectionException

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/012.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/012.phpt
+++ php-src/ext/reflection/tests/012.phpt
--TEST--
ReflectionClass::getDefaultProperties()
--FILE--
<?php
class Foo {
        public $test = "ok";
}
$class = new ReflectionClass("Foo");
$props = $class->getDefaultProperties();
echo $props["test"];
?>
--EXPECT--      
ok


http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/013.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/013.phpt
+++ php-src/ext/reflection/tests/013.phpt
--TEST--
ReflectionExtension::getFunctions()
--FILE--
<?php
$ext = new ReflectionExtension("standard");
$funcs = $ext->getFunctions();
echo $funcs["sleep"]->getName();
?>
--EXPECT--      
sleep


http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/014.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/014.phpt
+++ php-src/ext/reflection/tests/014.phpt
--TEST--
ReflectionExtension::getConstants()
--FILE--
<?php
$ext = new ReflectionExtension("standard");
$consts = $ext->getConstants();
var_dump($consts["CONNECTION_NORMAL"]);
?>
--EXPECT--      
int(0)


http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/015.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/015.phpt
+++ php-src/ext/reflection/tests/015.phpt
--TEST--
ReflectionExtension::getINIEntries()
--INI--
user_agent=php
--FILE--
<?php
$ext = new ReflectionExtension("standard");
$inis = $ext->getINIEntries();
var_dump($inis["user_agent"]);
?>
--EXPECT--      
string(3) "php"
--UEXPECT--     
unicode(3) "php"


http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/016.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/016.phpt
+++ php-src/ext/reflection/tests/016.phpt
--TEST--
ReflectionExtension::getDependencies()
--SKIPIF--
<?php
if (!extension_loaded("xml")) {
  die('skip xml extension not available');
}
?>
--FILE--
<?php
$ext = new ReflectionExtension("xml");
$deps = $ext->getDependencies();
var_dump($deps);
?>
--EXPECT--      
array(1) {
  ["libxml"]=>
  string(8) "Required"
}
--UEXPECT--
array(1) {
  [u"libxml"]=>
  unicode(8) "Required"
}

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/017.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/017.phpt
+++ php-src/ext/reflection/tests/017.phpt
--TEST--
ReflectionClass::__toString() (constants)
--FILE--
<?php
class Foo {
        const test = "ok";
}
$class = new ReflectionClass("Foo");
echo $class;
?>
--EXPECTF--     
Class [ <user> class Foo ] {
  @@ %s017.php 2-4

  - Constants [1] {
    Constant [ string test ] { ok }
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [0] {
  }
}
--UEXPECTF--    
Class [ <user> class Foo ] {
  @@ %s017.php 2-4

  - Constants [1] {
    Constant [ Unicode string test ] { ok }
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [0] {
  }
}


http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/018.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/018.phpt
+++ php-src/ext/reflection/tests/018.phpt
--TEST--
Reflection::getModifierNames
--FILE--
<?php
var_dump(Reflection::getModifierNames(ReflectionMethod::IS_FINAL | 
ReflectionMethod::IS_PROTECTED));
?>
--EXPECT--      
array(2) {
  [0]=>
  string(5) "final"
  [1]=>
  string(9) "protected"
}
--UEXPECT--     
array(2) {
  [0]=>
  unicode(5) "final"
  [1]=>
  unicode(9) "protected"
}

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/019.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/019.phpt
+++ php-src/ext/reflection/tests/019.phpt
--TEST--
ReflectionFunction::getExtensionName
--FILE--
<?php
$f = new ReflectionFunction("sleep");
var_dump($f->getExtensionName());
?>
--EXPECT--      
string(8) "standard"
--UEXPECT--     
unicode(8) "standard"

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/020.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/020.phpt
+++ php-src/ext/reflection/tests/020.phpt
--TEST--
ReflectionObject::hasProperty
--FILE--
<?php
class Foo {
        public    $p1;
        protected $p2;
        private   $p3;

        function __isset($name) {
                var_dump($name);
                return false;
        }
}
$obj = new ReflectionObject(new Foo());
var_dump($obj->hasProperty("p1"));
var_dump($obj->hasProperty("p2"));
var_dump($obj->hasProperty("p3"));
var_dump($obj->hasProperty("p4"));
?>
--EXPECT--      
bool(true)
bool(true)
bool(true)
string(2) "p4"
bool(false)
--UEXPECT--     
bool(true)
bool(true)
bool(true)
unicode(2) "p4"
bool(false)

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/021.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/021.phpt
+++ php-src/ext/reflection/tests/021.phpt
--TEST--
ReflectionClass::hasConstant
--FILE--
<?php
class Foo {
        const c1 = 1;
}
$class = new ReflectionClass("Foo");
var_dump($class->hasConstant("c1"));
var_dump($class->hasConstant("c2"));
?>
--EXPECT--      
bool(true)
bool(false)

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/022.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/022.phpt
+++ php-src/ext/reflection/tests/022.phpt
--TEST--
ReflectionClass::getConstant
--FILE--
<?php
class Foo {
        const c1 = 1;
}
$class = new ReflectionClass("Foo");
var_dump($class->getConstant("c1"));
var_dump($class->getConstant("c2"));
?>
--EXPECT--      
int(1)
bool(false)

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/023.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/023.phpt
+++ php-src/ext/reflection/tests/023.phpt
--TEST--
ReflectionClass::getDefaultProperties (filtering parent privates)
--FILE--
<?php
class C1 {
        private   $p1 = 1;
        protected $p2 = 2;
        public    $p3 = 3;
}
class C2 extends C1 {
        private   $p4 = 4;
        protected $p5 = 5;
        public    $p6 = 6;
}
$class = new ReflectionClass("C2");
var_dump($class->getDefaultProperties());
?>
--EXPECT--      
array(5) {
  ["p4"]=>
  int(4)
  ["p5"]=>
  int(5)
  ["p6"]=>
  int(6)
  ["p2"]=>
  int(2)
  ["p3"]=>
  int(3)
}
--UEXPECT--
array(5) {
  [u"p4"]=>
  int(4)
  [u"p5"]=>
  int(5)
  [u"p6"]=>
  int(6)
  [u"p2"]=>
  int(2)
  [u"p3"]=>
  int(3)
}

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/024.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/024.phpt
+++ php-src/ext/reflection/tests/024.phpt
--TEST--
ReflectionObject::__toString (filtering privates/protected dynamic properties)
--FILE--
<?php
class C1 {
        private   $p1 = 1;
        protected $p2 = 2;
        public    $p3 = 3;
}
$obj = new ReflectionObject(new C1());
echo $obj;
?>
--EXPECTF--     
Object of class [ <user> class C1 ] {
  @@ %s024.php 2-6

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [3] {
    Property [ <default> private $p1 ]
    Property [ <default> protected $p2 ]
    Property [ <default> public $p3 ]
  }

  - Dynamic properties [1] {
    Property [ <dynamic> public $p3 ]
  }

  - Methods [0] {
  }
}

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/025.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/025.phpt
+++ php-src/ext/reflection/tests/025.phpt
--TEST--
ReflectionFunction basic tests
--SKIPIF--
<?php extension_loaded('reflection') or die('skip'); ?>
--FILE--
<?php

/**
hoho
*/
function test ($a, $b = 1, $c = "") {
        static $var = 1;
}

$func = new ReflectionFunction("test");

var_dump($func->export("test"));
echo "--getName--\n";
var_dump($func->getName());
echo "--isInternal--\n";
var_dump($func->isInternal());
echo "--isUserDefined--\n";
var_dump($func->isUserDefined());
echo "--getFilename--\n";
var_dump($func->getFilename());
echo "--getStartline--\n";
var_dump($func->getStartline());
echo "--getEndline--\n";
var_dump($func->getEndline());
echo "--getDocComment--\n";
var_dump($func->getDocComment());
echo "--getStaticVariables--\n";
var_dump($func->getStaticVariables());
echo "--invoke--\n";
var_dump($func->invoke(array(1,2,3)));
echo "--invokeArgs--\n";
var_dump($func->invokeArgs(array(1,2,3)));
echo "--returnsReference--\n";
var_dump($func->returnsReference());
echo "--getParameters--\n";
var_dump($func->getParameters());
echo "--getNumberOfParameters--\n";
var_dump($func->getNumberOfParameters());
echo "--getNumberOfRequiredParameters--\n";
var_dump($func->getNumberOfRequiredParameters());

echo "Done\n";

?>
--EXPECTF--     
/**
hoho
*/
Function [ <user> function test ] {
  @@ %s025.php 6 - 8

  - Parameters [3] {
    Parameter #0 [ <required> $a ]
    Parameter #1 [ <optional> $b = 1 ]
    Parameter #2 [ <optional> $c = '' ]
  }
}

NULL
--getName--
string(4) "test"
--isInternal--
bool(false)
--isUserDefined--
bool(true)
--getFilename--
string(%d) "%s025.php"
--getStartline--
int(6)
--getEndline--
int(8)
--getDocComment--
string(11) "/**
hoho
*/"
--getStaticVariables--
array(1) {
  ["var"]=>
  int(1)
}
--invoke--
NULL
--invokeArgs--
NULL
--returnsReference--
bool(false)
--getParameters--
array(3) {
  [0]=>
  &object(ReflectionParameter)#2 (1) {
    ["name"]=>
    string(1) "a"
  }
  [1]=>
  &object(ReflectionParameter)#3 (1) {
    ["name"]=>
    string(1) "b"
  }
  [2]=>
  &object(ReflectionParameter)#4 (1) {
    ["name"]=>
    string(1) "c"
  }
}
--getNumberOfParameters--
int(3)
--getNumberOfRequiredParameters--
int(1)
Done
--UEXPECTF--
/**
hoho
*/
Function [ <user> function test ] {
  @@ %s 6 - 8

  - Parameters [3] {
    Parameter #0 [ <required> $a ]
    Parameter #1 [ <optional> $b = 1 ]
    Parameter #2 [ <optional> $c = '' ]
  }
}

NULL
--getName--
unicode(4) "test"
--isInternal--
bool(false)
--isUserDefined--
bool(true)
--getFilename--
unicode(%d) "%s025.php"
--getStartline--
int(6)
--getEndline--
int(8)
--getDocComment--
unicode(11) "/**
hoho
*/"
--getStaticVariables--
array(1) {
  [u"var"]=>
  int(1)
}
--invoke--
NULL
--invokeArgs--
NULL
--returnsReference--
bool(false)
--getParameters--
array(3) {
  [0]=>
  &object(ReflectionParameter)#2 (1) {
    [u"name"]=>
    unicode(1) "a"
  }
  [1]=>
  &object(ReflectionParameter)#3 (1) {
    [u"name"]=>
    unicode(1) "b"
  }
  [2]=>
  &object(ReflectionParameter)#4 (1) {
    [u"name"]=>
    unicode(1) "c"
  }
}
--getNumberOfParameters--
int(3)
--getNumberOfRequiredParameters--
int(1)
Done

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to