]> granicus.if.org Git - php/commitdiff
add new test and SKIPIF sections
authorAntony Dovgal <tony2001@php.net>
Thu, 12 Apr 2007 12:43:54 +0000 (12:43 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 12 Apr 2007 12:43:54 +0000 (12:43 +0000)
25 files changed:
ext/reflection/tests/009.phpt
ext/reflection/tests/010.phpt
ext/reflection/tests/011.phpt
ext/reflection/tests/012.phpt
ext/reflection/tests/013.phpt
ext/reflection/tests/014.phpt
ext/reflection/tests/015.phpt
ext/reflection/tests/016.phpt
ext/reflection/tests/017.phpt
ext/reflection/tests/018.phpt
ext/reflection/tests/019.phpt
ext/reflection/tests/020.phpt
ext/reflection/tests/021.phpt
ext/reflection/tests/022.phpt
ext/reflection/tests/023.phpt
ext/reflection/tests/024.phpt
ext/reflection/tests/025.phpt [new file with mode: 0644]
ext/reflection/tests/bug37816.phpt
ext/reflection/tests/bug38217.phpt
ext/reflection/tests/bug38653.phpt
ext/reflection/tests/bug38942.phpt
ext/reflection/tests/bug39001.phpt
ext/reflection/tests/bug39067.phpt
ext/reflection/tests/bug39884.phpt
ext/reflection/tests/bug40431.phpt

index e88c6d5aba88330c296d4979697a0097f510fa64..4e81a025fcbd7894cfc5cb7d1af89fc8e67e44fc 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionMethod::__construct() tests
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 
index 361019a08fb6bdfbe017f5272f798e9fc718fa89..8f92feea09e071c05e1a4142b1c64878a1d936b7 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionMethod::__toString() tests (overriden method)
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 class Foo {
index 500a84d3118ffe440f1194cb38717a2a78e76c41..b39be37c90a0f917d614a65da4d8adf3d4d8633f 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionExtension::getClasses()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 $ext = new ReflectionExtension("reflection");
index 541fdbe1415cbb5e99d67d8cd2137443e934e685..b8a2694004b12abfb8627d96919a59185e341a8e 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionClass::getDefaultProperties()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 class Foo {
index 87e51c6a89a6b73f717cc50dab1b39fc5aed74e0..9ecfa8b66c7d735bd321cbfeea170a5fccadc405 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionExtension::getFunctions()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 $ext = new ReflectionExtension("standard");
index 3aaea234686b60536af16ff4c30685d7b4d0efe5..8b5955f12487a97779a804c5c635b9e6296e1d51 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionExtension::getConstants()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 $ext = new ReflectionExtension("standard");
index 2abf510ba67d344df8def15b33061d77d60c2a73..9035c19b9696010e3032037bee8bde52b2c56a20 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionExtension::getINIEntries()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --INI--
 user_agent=php
 --FILE--
index 1c8ec6be630098d570adfb7afb896c66ca870a93..e1f71b3697637ee69d1e155b4d5d54bfa2b3ac33 100755 (executable)
@@ -2,6 +2,7 @@
 ReflectionExtension::getDependencies()
 --SKIPIF--
 <?php
+extension_loaded('reflection') or die('skip'); 
 if (!extension_loaded("xml")) {
   die('skip xml extension not available');
 }
index 58d5a6d19f331686f0f22bd285906d9873ce753c..56bd508d150eee79fa6c483b6f7f9995c610b0aa 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionClass::__toString() (constants)
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 class Foo {
index f25a1aec86159000a810022d6600d683f30e56c7..0cebd82ab65109557aa30b3df5d8affcaec3db66 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 Reflection::getModifierNames
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 var_dump(Reflection::getModifierNames(ReflectionMethod::IS_FINAL | ReflectionMethod::IS_PROTECTED));
index 0b1199dbe0a7d62ce14931c3cc2666344e446c21..0f7daa21edcc44a25499464f8b3f0b93ebf428a2 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionFunction::getExtensionName
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 $f = new ReflectionFunction("sleep");
index 67dcebe253f62b07656248560b3e1f2a037bc584..8856acb0c7dc4bdc98bc253abe5614bfe6c62f05 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionObject::hasProperty
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 class Foo {
index 9df3f0aeb44d01b82227c528d616ac3f9f30479a..30dbb5afcb3b06e155996869943f078e6d49b6d4 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionClass::hasConstant
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 class Foo {
index 91324613b97eb3be1bbffe12d5348d427db1b9f0..50dbd6ec74fb98ea2d633afdf302f8829754d593 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionClass::getConstant
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 class Foo {
index dc7a847f0b0f3b2e7666ea38c8823c4fc60e6df4..8085f15c15620e0614774a40164d7860259c8452 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionClass::getDefaultProperties (filtering parent privates)
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 class C1 {
index b05a4501b393453f845166928de0a351c67c625e..d1af28dfc9bab0fa7d3193ce1dc43d20228eaab7 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 ReflectionObject::__toString (filtering privates/protected dynamic properties)
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 class C1 {
diff --git a/ext/reflection/tests/025.phpt b/ext/reflection/tests/025.phpt
new file mode 100644 (file)
index 0000000..06da4b9
--- /dev/null
@@ -0,0 +1,179 @@
+--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
index 18a49046dc799358ab701359cbf0956e8f32dbc2..1121d541882bc6bd01950d5b9b5694412c966178 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 Bug #37816 (ReflectionProperty does not throw exception when accessing protected attribute)
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 
index 7a1e22b850de28c093fac457ec8ae88763d5c224..959e16a820068bedc76363da1256913175e8bcbd 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
-#38217 (ReflectionClass::newInstanceArgs() tries to allocate too much memory)
+Bug #38217 (ReflectionClass::newInstanceArgs() tries to allocate too much memory)
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 
index 48f1c6ce41a8fb7d3715782f0ec96f45053111c0..c9025166d5fea30969ddf5ba9e1b0cfedc0fb6d0 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 Bug #38653 (memory leak in ReflectionClass::getConstant())
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 
index 817190c997041837ea942351836e63fbd686ddd6..a02f596aff3fa3806183dc5d6ec52914bad3771d 100755 (executable)
@@ -1,5 +1,7 @@
 --TEST--
 Bug #38942 (Double old-style-ctor inheritance)
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 class foo {
index bf8927d661f3c1bf840e853d79b996f39a6daecb..91fa86518887a3cd667bd1e93aba2f7e4af7b6af 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 Bug #39001 (ReflectionProperty returns incorrect declaring class for protected properties)
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 
index 5aae08315239ad30f282c94f2019cddd851629b3..a22c53a68a08a3fd5326a44f8095bfcfd59df60c 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 Bug #39067 (getDeclaringClass() and private properties)
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 
index 874fb54078da28c1b0f3788375f7040e2c7d8b8e..8882c0cbab99ae0df2dbf03f5f8867f259bedcb8 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 Bug #39884 (ReflectionParameter::getClass() throws exception for type hint self)
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
 class stubParamTest
index 68c18cf0d4898603775b337a0ab5e20f18c655a4..e881789c79e64c55199bb954646df8efac0efc69 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 Bug #40431 (dynamic properties may cause crash in ReflectionProperty methods)
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php