Yaffs site version 1.1
[yaffs-website] / vendor / phpdocumentor / reflection-docblock / tests / phpDocumentor / Reflection / DocBlock / Tag / ReturnTagTest.php
1 <?php
2 /**
3  * phpDocumentor Return 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\ReturnTag
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 ReturnTagTest extends \PHPUnit_Framework_TestCase
24 {
25     /**
26      * Test that the \phpDocumentor\Reflection\DocBlock\Tag\ReturnTag can
27      * understand the @return DocBlock.
28      *
29      * @param string $type
30      * @param string $content
31      * @param string $extractedType
32      * @param string $extractedTypes
33      * @param string $extractedDescription
34      *
35      * @covers \phpDocumentor\Reflection\DocBlock\Tag\ReturnTag
36      * @dataProvider provideDataForConstructor
37      *
38      * @return void
39      */
40     public function testConstructorParsesInputsIntoCorrectFields(
41         $type,
42         $content,
43         $extractedType,
44         $extractedTypes,
45         $extractedDescription
46     ) {
47         $tag = new ReturnTag($type, $content);
48
49         $this->assertEquals($type, $tag->getName());
50         $this->assertEquals($extractedType, $tag->getType());
51         $this->assertEquals($extractedTypes, $tag->getTypes());
52         $this->assertEquals($extractedDescription, $tag->getDescription());
53     }
54
55     /**
56      * Data provider for testConstructorParsesInputsIntoCorrectFields()
57      *
58      * @return array
59      */
60     public function provideDataForConstructor()
61     {
62         return array(
63             array('return', '', '', array(), ''),
64             array('return', 'int', 'int', array('int'), ''),
65             array(
66                 'return',
67                 'int Number of Bobs',
68                 'int',
69                 array('int'),
70                 'Number of Bobs'
71             ),
72             array(
73                 'return',
74                 'int|double Number of Bobs',
75                 'int|double',
76                 array('int', 'double'),
77                 'Number of Bobs'
78             ),
79             array(
80                 'return',
81                 "int Number of \n Bobs",
82                 'int',
83                 array('int'),
84                 "Number of \n Bobs"
85             ),
86             array(
87                 'return',
88                 " int Number of Bobs",
89                 'int',
90                 array('int'),
91                 "Number of Bobs"
92             ),
93             array(
94                 'return',
95                 "int\nNumber of Bobs",
96                 'int',
97                 array('int'),
98                 "Number of Bobs"
99             )
100         );
101     }
102 }