]> granicus.if.org Git - php/commitdiff
More basic ReflectionClass tests from Dutch TestFest.
authorRobin Fernandes <robinf@php.net>
Fri, 23 May 2008 21:14:05 +0000 (21:14 +0000)
committerRobin Fernandes <robinf@php.net>
Fri, 23 May 2008 21:14:05 +0000 (21:14 +0000)
16 files changed:
ext/reflection/tests/reflectionClass_getConstructor_basic.phpt
ext/reflection/tests/reflectionClass_getExtensionName_basic.phpt [new file with mode: 0644]
ext/reflection/tests/reflectionClass_getExtensionName_variation.phpt [new file with mode: 0644]
ext/reflection/tests/reflectionClass_getExtension_basic.phpt [new file with mode: 0644]
ext/reflection/tests/reflectionClass_getExtension_variation.phpt [new file with mode: 0644]
ext/reflection/tests/reflectionClass_getInterfaceNames_basic.phpt [new file with mode: 0644]
ext/reflection/tests/reflectionClass_getModifiers_basic.phpt
ext/reflection/tests/reflectionClass_getParentClass.phpt
ext/reflection/tests/reflectionClass_hasConstant_basic.phpt
ext/reflection/tests/reflectionClass_hasMethod_basic.phpt
ext/reflection/tests/reflectionClass_hasProperty_basic.phpt
ext/reflection/tests/reflectionClass_isAbstract_basic.phpt [new file with mode: 0644]
ext/reflection/tests/reflectionClass_isFinal_basic.phpt [new file with mode: 0644]
ext/reflection/tests/reflectionClass_isInterface_basic.phpt
ext/reflection/tests/reflectionClass_isIterateable_basic.phpt
ext/reflection/tests/reflectionClass_isIterateable_variation1.phpt

index 1b5b2984f8ff4d4752ec0d84b77e806638716851..16b0aca714739b0aad7ad18bdba84366a5a4b86a 100644 (file)
@@ -1,5 +1,10 @@
 --TEST--
 ReflectionClass::getConstructor()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip - reflection extension not loaded'); ?>
+--CREDITS--
+Michelangelo van Dam <dragonbe@gmail.com>
+#testfest roosendaal on 2008-05-10
 --FILE--
 <?php
 class NewCtor {
@@ -61,7 +66,7 @@ foreach ($classes as $class) {
        }
        
 }                               
-                               
+                                
 ?>
 --EXPECTF--
 
@@ -79,21 +84,4 @@ Constructor of C: C
 Constructor of D1: __construct
 Constructor of D2: C
 No constructor for X
-No constructor for Y
---UEXPECTF--
-
-Strict Standards: Redefining already defined constructor for class OldAndNewCtor in %s on line 26
-
-Strict Standards: %s for class NewAndOldCtor in %s on line 31
-Constructor of NewCtor: __construct
-Constructor of ExtendsNewCtor: __construct
-Constructor of OldCtor: OldCtor
-Constructor of ExtendsOldCtor: OldCtor
-Constructor of OldAndNewCtor: __construct
-Constructor of NewAndOldCtor: __construct
-Constructor of B: B
-Constructor of C: C
-Constructor of D1: __construct
-Constructor of D2: C
-No constructor for X
-No constructor for Y
+No constructor for Y
\ No newline at end of file
diff --git a/ext/reflection/tests/reflectionClass_getExtensionName_basic.phpt b/ext/reflection/tests/reflectionClass_getExtensionName_basic.phpt
new file mode 100644 (file)
index 0000000..5c28bd1
--- /dev/null
@@ -0,0 +1,16 @@
+--TEST--
+ReflectionClass::getExtensionName() method - basic test for getExtensionName() method
+--SKIPIF--
+<?php extension_loaded('reflection') && extension_loaded('dom') or die('skip - reflection or dom extension not loaded'); ?>
+--CREDITS--
+Rein Velt <rein@velt.org>
+#testFest Roosendaal 2008-05-10
+--FILE--
+<?php
+       $rc=new reflectionClass('domDocument');
+       var_dump( $rc->getExtensionName()) ;
+?>
+--EXPECT--
+string(3) "dom"
+--UEXPECT--
+unicode(3) "dom"
\ No newline at end of file
diff --git a/ext/reflection/tests/reflectionClass_getExtensionName_variation.phpt b/ext/reflection/tests/reflectionClass_getExtensionName_variation.phpt
new file mode 100644 (file)
index 0000000..35372c4
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+ReflectionClass::getExtensionName() method - variation test for getExtensionName()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip - reflection extension not loaded'); ?>
+--CREDITS--
+Rein Velt <rein@velt.org>
+#testFest Roosendaal 2008-05-10
+--FILE--
+<?php
+
+       class myClass
+       {       
+               public $varX;
+               public $varY;
+       }
+       $rc=new reflectionClass('myClass');
+       var_dump( $rc->getExtensionName()) ;
+?>
+--EXPECT--
+bool(false)
\ No newline at end of file
diff --git a/ext/reflection/tests/reflectionClass_getExtension_basic.phpt b/ext/reflection/tests/reflectionClass_getExtension_basic.phpt
new file mode 100644 (file)
index 0000000..432bba0
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+ReflectionClass::getExtension() method - basic test for getExtension() method
+--SKIPIF--
+<?php extension_loaded('reflection') && extension_loaded('dom') or die('skip - reflection or dom extension not loaded'); ?>
+--CREDITS--
+Rein Velt <rein@velt.org>
+#testFest Roosendaal 2008-05-10
+--FILE--
+<?php
+       $rc=new reflectionClass('domDocument');
+       var_dump($rc->getExtension()) ;
+?>
+--EXPECTF--
+object(ReflectionExtension)#%d (1) {
+  ["name"]=>
+  string(3) "dom"
+}
+--UEXPECTF--
+object(ReflectionExtension)#%d (1) {
+  [u"name"]=>
+  unicode(3) "dom"
+}
\ No newline at end of file
diff --git a/ext/reflection/tests/reflectionClass_getExtension_variation.phpt b/ext/reflection/tests/reflectionClass_getExtension_variation.phpt
new file mode 100644 (file)
index 0000000..f227277
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+ReflectionClass::getExtension() method - variation test for getExtension()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip - reflection extension not loaded'); ?>
+--CREDITS--
+Rein Velt <rein@velt.org>
+#testFest Roosendaal 2008-05-10
+--FILE--
+<?php
+
+       class myClass
+       {       
+               public $varX;
+               public $varY;
+       }
+       $rc=new reflectionClass('myClass');
+       var_dump( $rc->getExtension()) ;
+?>
+--EXPECT--
+NULL
\ No newline at end of file
diff --git a/ext/reflection/tests/reflectionClass_getInterfaceNames_basic.phpt b/ext/reflection/tests/reflectionClass_getInterfaceNames_basic.phpt
new file mode 100644 (file)
index 0000000..c13ef37
--- /dev/null
@@ -0,0 +1,32 @@
+--TEST--
+ReflectionClass::getInterfaceNames()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip - reflection extension not loaded'); ?>
+--CREDITS--
+Michelangelo van Dam <dragonbe@gmail.com>
+#testfest roosendaal on 2008-05-10
+--FILE--
+<?php
+interface Foo { }
+
+interface Bar { }
+
+class Baz implements Foo, Bar { }
+
+$rc1 = new ReflectionClass("Baz");
+var_dump($rc1->getInterfaceNames());
+?>
+--EXPECT--
+array(2) {
+  [0]=>
+  string(3) "Foo"
+  [1]=>
+  string(3) "Bar"
+}
+--UEXPECT--
+array(2) {
+  [0]=>
+  unicode(3) "Foo"
+  [1]=>
+  unicode(3) "Bar"
+}
\ No newline at end of file
index 5d2592d17e156c44f77ca02249266eaa226fd71b..fad4e318c331d3e7eb23592daf2ad481d4018848 100644 (file)
@@ -1,7 +1,7 @@
 --TEST--
 ReflectionClass::getModifiers()
 --SKIPIF--
-<?php extension_loaded('reflection') or die('skip'); ?>
+<?php extension_loaded('reflection') or die('skip - reflection extension not loaded'); ?>
 --CREDITS--
 Felix De Vliegher <felix.devliegher@gmail.com>
 --FILE--
index 32c01aeafdc481dbf1f4fc1c6f2b6c353005da43..fbdfa0b7ed735142872d6fde8ac21acd672f58a1 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionClass::getParentClass()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip - reflection extension not loaded'); ?>
 --CREDITS--
 Michelangelo van Dam <dragonbe@gmail.com>
 #testfest roosendaal on 2008-05-10
index 49570150c71f6dd9e6e34f5d4f4ede9e787f333c..75d3d30e782dade64b3ac8e7b286669302083b6a 100644 (file)
@@ -1,6 +1,8 @@
 --TEST--
 ReflectionClass::hasConstant()
---CREDIT--
+--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-- 
index 3ef5ac9202f3c3fb3e14659c473bb2fe1262c24d..700218951f4bed2402940af7c490b790327dd51b 100644 (file)
@@ -1,6 +1,8 @@
 --TEST--
 ReflectionClass::hasMethod()
---CREDIT--
+--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-- 
index b3264e01ed05fbc8ef14e890cfcb4614077875e4..26ca6a4cd58d15162445ee7da4030ebd8625fc72 100644 (file)
@@ -1,6 +1,8 @@
 --TEST--
 ReflectionClass::hasProperty()
---CREDIT--
+--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-- 
diff --git a/ext/reflection/tests/reflectionClass_isAbstract_basic.phpt b/ext/reflection/tests/reflectionClass_isAbstract_basic.phpt
new file mode 100644 (file)
index 0000000..7a3d577
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+ReflectionClass::isAbstract() method
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip - reflection extension not loaded'); ?>
+--CREDITS--
+Felix De Vliegher <felix.devliegher@gmail.com>
+#testfest roosendaal on 2008-05-10
+--FILE--
+<?php
+
+class TestClass {}
+abstract class TestAbstractClass {}
+
+$testClass = new ReflectionClass('TestClass');
+$abstractClass = new ReflectionClass('TestAbstractClass');
+
+var_dump($testClass->isAbstract());
+var_dump($abstractClass->isAbstract());
+
+?>
+--EXPECT--
+bool(false)
+bool(true)
diff --git a/ext/reflection/tests/reflectionClass_isFinal_basic.phpt b/ext/reflection/tests/reflectionClass_isFinal_basic.phpt
new file mode 100644 (file)
index 0000000..efa1317
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+ReflectionClass::isFinal() method
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip - reflection extension not loaded'); ?>
+--CREDITS--
+Felix De Vliegher <felix.devliegher@gmail.com>
+#testfest roosendaal on 2008-05-10
+--FILE--
+<?php
+
+class TestClass {}
+final class TestFinalClass {}
+
+$normalClass = new ReflectionClass('TestClass');
+$finalClass = new ReflectionClass('TestFinalClass');
+
+var_dump($normalClass->isFinal());
+var_dump($finalClass->isFinal());
+
+?>
+--EXPECT--
+bool(false)
+bool(true)
index 2870725e83eaba76fd7bb28279cfa01c92387c12..2e5c6302d837840ec47938191e7a4961044614fb 100644 (file)
@@ -1,7 +1,7 @@
 --TEST--
 ReflectionClass::isInterface() method
 --SKIPIF--
-<?php extension_loaded('reflection') or die('skip'); ?>
+<?php extension_loaded('reflection') or die('skip - reflection extension not loaded'); ?>
 --CREDITS--
 Felix De Vliegher <felix.devliegher@gmail.com>
 #testfest roosendaal on 2008-05-10
index 3e1228af25efb533079ed1cbdab36f5b5e984e56..cfcf799e38f7394dbc9e994061fa80f9af0f3b37 100644 (file)
@@ -1,7 +1,7 @@
 --TEST--
 ReflectionClass::isIterateable() basic
 --SKIPIF--
-<?php extension_loaded('reflection') or die('skip'); ?>
+<?php extension_loaded('reflection') or die('skip - reflection extension not loaded'); ?>
 --CREDITS--
 Felix De Vliegher <felix.devliegher@gmail.com>, Marc Veldman <marc@ibuildings.nl>
 --FILE--
index 6d737bb893522648768769dff3674b143b406526..654a37ec99ab49167f2489400d7e2d7c77b46ed8 100644 (file)
@@ -1,7 +1,7 @@
 --TEST--
 ReflectionClass::isIterateable() variations
 --SKIPIF--
-<?php extension_loaded('reflection') or die('skip'); ?>
+<?php extension_loaded('reflection') or die('skip - reflection extension not loaded'); ?>
 --CREDITS--
 Felix De Vliegher <felix.devliegher@gmail.com>
 --FILE--