summaryrefslogtreecommitdiff
path: root/ext/reflection/tests/005.phpt
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:35:13 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:35:13 -0400
commit0a36161e13484a99ccf69bb38f206462d27cc6d6 (patch)
treed5107db4b7369603ac7c753829e8972ee74949f7 /ext/reflection/tests/005.phpt
parentce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61 (diff)
downloadphp-upstream/5.1.2.tar.gz
Imported Upstream version 5.1.2upstream/5.1.2
Diffstat (limited to 'ext/reflection/tests/005.phpt')
-rwxr-xr-xext/reflection/tests/005.phpt54
1 files changed, 54 insertions, 0 deletions
diff --git a/ext/reflection/tests/005.phpt b/ext/reflection/tests/005.phpt
new file mode 100755
index 000000000..f337e44ae
--- /dev/null
+++ b/ext/reflection/tests/005.phpt
@@ -0,0 +1,54 @@
+--TEST--
+ReflectionMethod::getDocComment() uses wrong comment block
+--FILE--
+<?php
+
+function strip_doc_comment($c)
+{
+ if (!strlen($c) || $c === false) return $c;
+ return trim(substr($c, 3, -2));
+}
+
+/** Comment for class A */
+class A
+{
+ /** Method A::bla()
+ */
+ function bla()
+ {
+ }
+
+ function foo() {
+ /**
+ * This is a valid comment inside a method
+ */
+ }
+
+ function bar() {
+ // I don't have a doc comment....
+ }
+
+ /**
+ * Comment for A::baz()
+ */
+ function baz() {
+ }
+}
+
+$r = new ReflectionClass('A');
+var_dump(strip_doc_comment($r->getDocComment()));
+
+foreach($r->getMethods() as $m)
+{
+ var_dump(strip_doc_comment($m->getDocComment()));
+}
+
+?>
+===DONE===
+--EXPECT--
+string(19) "Comment for class A"
+string(15) "Method A::bla()"
+bool(false)
+bool(false)
+string(22) "* Comment for A::baz()"
+===DONE===