Yaffs site version 1.1
[yaffs-website] / vendor / phpdocumentor / reflection-docblock / tests / phpDocumentor / Reflection / DocBlock / Tag / ParamTagTest.php
1 <?php
2 /**
3  * phpDocumentor Param tag test.
4  * 
5  * PHP version 5.3
6  *
7  * @author    Mike van Riel <mike.vanriel@naenius.com>
8  * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
9  * @license   http://www.opensource.org/licenses/mit-license.php MIT
10  * @link      http://phpdoc.org
11  */
12
13 namespace phpDocumentor\Reflection\DocBlock\Tag;
14
15 /**
16  * Test class for \phpDocumentor\Reflection\DocBlock\ParamTag
17  *
18  * @author    Mike van Riel <mike.vanriel@naenius.com>
19  * @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
20  * @license   http://www.opensource.org/licenses/mit-license.php MIT
21  * @link      http://phpdoc.org
22  */
23 class ParamTagTest extends \PHPUnit_Framework_TestCase
24 {
25     /**
26      * Test that the \phpDocumentor\Reflection\DocBlock\Tag\ParamTag can
27      * understand the @param DocBlock.
28      *
29      * @param string $type
30      * @param string $content
31      * @param string $extractedType
32      * @param string $extractedTypes
33      * @param string $extractedVarName
34      * @param string $extractedDescription
35      *
36      * @covers \phpDocumentor\Reflection\DocBlock\Tag\ParamTag
37      * @dataProvider provideDataForConstructor
38      *
39      * @return void
40      */
41     public function testConstructorParsesInputsIntoCorrectFields(
42         $type,
43         $content,
44         $extractedType,
45         $extractedTypes,
46         $extractedVarName,
47         $extractedDescription
48     ) {
49         $tag = new ParamTag($type, $content);
50
51         $this->assertEquals($type, $tag->getName());
52         $this->assertEquals($extractedType, $tag->getType());
53         $this->assertEquals($extractedTypes, $tag->getTypes());
54         $this->assertEquals($extractedVarName, $tag->getVariableName());
55         $this->assertEquals($extractedDescription, $tag->getDescription());
56     }
57
58     /**
59      * Data provider for testConstructorParsesInputsIntoCorrectFields()
60      *
61      * @return array
62      */
63     public function provideDataForConstructor()
64     {
65         return array(
66             array('param', 'int', 'int', array('int'), '', ''),
67             array('param', '$bob', '', array(), '$bob', ''),
68             array(
69                 'param',
70                 'int Number of bobs',
71                 'int',
72                 array('int'),
73                 '',
74                 'Number of bobs'
75             ),
76             array(
77                 'param',
78                 'int $bob',
79                 'int',
80                 array('int'),
81                 '$bob',
82                 ''
83             ),
84             array(
85                 'param',
86                 'int $bob Number of bobs',
87                 'int',
88                 array('int'),
89                 '$bob',
90                 'Number of bobs'
91             ),
92             array(
93                 'param',
94                 "int Description \n on multiple lines",
95                 'int',
96                 array('int'),
97                 '',
98                 "Description \n on multiple lines"
99             ),
100             array(
101                 'param',
102                 "int \n\$bob Variable name on a new line",
103                 'int',
104                 array('int'),
105                 '$bob',
106                 "Variable name on a new line"
107             ),
108             array(
109                 'param',
110                 "\nint \$bob Type on a new line",
111                 'int',
112                 array('int'),
113                 '$bob',
114                 "Type on a new line"
115             )
116         );
117     }
118 }