3 * phpDocumentor Method Tag Test
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
13 namespace phpDocumentor\Reflection\DocBlock\Tag;
16 * Test class for \phpDocumentor\Reflection\DocBlock\Tag\MethodTag
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
23 class MethodTagTest extends \PHPUnit_Framework_TestCase
26 * @param string $signature The signature to test.
27 * @param bool $valid Whether the given signature is expected to
29 * @param string $expected_name The method name that is expected from this
31 * @param string $expected_return The return type that is expected from this
33 * @param bool $paramCount Number of parameters in the signature.
34 * @param string $description The short description mentioned in the
37 * @covers \phpDocumentor\Reflection\DocBlock\Tag\MethodTag
38 * @dataProvider getTestSignatures
42 public function testConstruct(
52 $tag = new MethodTag('method', $signature);
53 $stdout = ob_get_clean();
58 'No error should have been output if the signature is valid'
65 $this->assertEquals($expected_name, $tag->getMethodName());
66 $this->assertEquals($expected_return, $tag->getType());
67 $this->assertEquals($description, $tag->getDescription());
68 $this->assertEquals($expected_isStatic, $tag->isStatic());
69 $this->assertCount($paramCount, $tag->getArguments());
72 public function getTestSignatures()
75 // TODO: Verify this case
78 // false, 'foo', '', false, 0, ''
82 true, 'foo', 'void', false, 0, ''
86 true, 'foo', 'void', false, 0, 'description'
90 true, 'foo', 'int', false, 0, ''
93 'int foo() description',
94 true, 'foo', 'int', false, 0, 'description'
98 true, 'foo', 'int', false, 2, ''
101 'int foo() foo(int $a, int $b)',
102 true, 'foo', 'int', false, 2, ''
105 'int foo(int $a, int $b)',
106 true, 'foo', 'int', false, 2, ''
109 'null|int foo(int $a, int $b)',
110 true, 'foo', 'null|int', false, 2, ''
113 'int foo(null|int $a, int $b)',
114 true, 'foo', 'int', false, 2, ''
117 '\Exception foo() foo(Exception $a, Exception $b)',
118 true, 'foo', '\Exception', false, 2, ''
121 'int foo() foo(Exception $a, Exception $b) description',
122 true, 'foo', 'int', false, 2, 'description'
125 'int foo() foo(\Exception $a, \Exception $b) description',
126 true, 'foo', 'int', false, 2, 'description'
130 true, 'void', 'void', false, 0, ''
134 true, 'foo', 'static', false, 0, ''
138 true, 'foo', 'void', true, 0, ''
141 'static static foo()',
142 true, 'foo', 'static', true, 0, ''