소스 검색

ZF-6996: backport r20617 to trunk

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20618 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 16 년 전
부모
커밋
f033ae5b7a
2개의 변경된 파일18개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 1
      library/Zend/Server/Reflection/Function/Abstract.php
  2. 17 3
      tests/Zend/Server/Reflection/FunctionTest.php

+ 1 - 1
library/Zend/Server/Reflection/Function/Abstract.php

@@ -293,7 +293,7 @@ abstract class Zend_Server_Reflection_Function_Abstract
             // Get param types and description
             if (preg_match_all('/@param\s+([^\s]+)/m', $docBlock, $matches)) {
                 $paramTypesTmp = $matches[1];
-                if (preg_match_all('/@param\s+\S+\s+(\$^\S+)\s+(.*?)(@|\*\/)/s', $docBlock, $matches))
+                if (preg_match_all('/@param\s+\S+\s+(\$\S+)\s+(.*?)(@|\*\/)/s', $docBlock, $matches))
                 {
                     $paramDesc = $matches[2];
                     foreach ($paramDesc as $key => $value) {

+ 17 - 3
tests/Zend/Server/Reflection/FunctionTest.php

@@ -20,9 +20,8 @@
  * @version $Id$
  */
 
+require_once dirname(__FILE__) . '/../../../TestHelper.php';
 require_once 'Zend/Server/Reflection/Function.php';
-require_once 'PHPUnit/Framework/TestCase.php';
-require_once 'PHPUnit/Framework/IncompleteTestError.php';
 
 /**
  * Test case for Zend_Server_Reflection_Function
@@ -164,6 +163,21 @@ class Zend_Server_Reflection_FunctionTest extends PHPUnit_Framework_TestCase
         $this->assertEquals(1, count($params));
         $this->assertEquals('string', $params[0]->getType());
     }
+
+    /**
+     * @group ZF-6996
+     */
+    public function testParameterReflectionShouldReturnTypeAndVarnameAndDescription()
+    {
+        $function = new ReflectionFunction('Zend_Server_Reflection_FunctionTest_function');
+        $r = new Zend_Server_Reflection_Function($function);
+
+        $prototypes = $r->getPrototypes();
+        $prototype  = $prototypes[0];
+        $params = $prototype->getParameters();
+        $param  = $params[0];
+        $this->assertContains('Some description', $param->getDescription(), var_export($param, 1));
+    }
 }
 
 /**
@@ -171,7 +185,7 @@ class Zend_Server_Reflection_FunctionTest extends PHPUnit_Framework_TestCase
  *
  * Test function for reflection unit tests
  *
- * @param string $var1
+ * @param string $var1 Some description
  * @param string|array $var2
  * @param array $var3
  * @return null|array