First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
245
vendor/phpdocumentor/reflection-docblock/tests/phpDocumentor/Reflection/DocBlock/DescriptionTest.php
vendored
Normal file
245
vendor/phpdocumentor/reflection-docblock/tests/phpDocumentor/Reflection/DocBlock/DescriptionTest.php
vendored
Normal file
|
@ -0,0 +1,245 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Description Test
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Description
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class DescriptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(1, $parsedContents);
|
||||
$this->assertSame($fixture, $parsedContents[0]);
|
||||
}
|
||||
|
||||
public function testInlineTagParsing()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a {@link http://phpdoc.org/ description} that uses inline
|
||||
tags.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
$this->assertSame('This is text for a ', $parsedContents[0]);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag\LinkTag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame(
|
||||
' that uses inline
|
||||
tags.',
|
||||
$parsedContents[2]
|
||||
);
|
||||
}
|
||||
|
||||
public function testInlineTagAtStartParsing()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
{@link http://phpdoc.org/ This} is text for a description that uses inline
|
||||
tags.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
|
||||
$this->assertSame('', $parsedContents[0]);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag\LinkTag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame(
|
||||
' is text for a description that uses inline
|
||||
tags.',
|
||||
$parsedContents[2]
|
||||
);
|
||||
}
|
||||
|
||||
public function testNestedInlineTagParsing()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with {@internal inline tag with
|
||||
{@link http://phpdoc.org another inline tag} in it}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
|
||||
$this->assertSame(
|
||||
'This is text for a description with ',
|
||||
$parsedContents[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame('.', $parsedContents[2]);
|
||||
|
||||
$parsedDescription = $parsedContents[1]->getParsedDescription();
|
||||
$this->assertCount(3, $parsedDescription);
|
||||
$this->assertSame("inline tag with\n", $parsedDescription[0]);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag\LinkTag',
|
||||
$parsedDescription[1]
|
||||
);
|
||||
$this->assertSame(' in it', $parsedDescription[2]);
|
||||
}
|
||||
|
||||
public function testLiteralOpeningDelimiter()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description containing { that is literal.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(1, $parsedContents);
|
||||
$this->assertSame($fixture, $parsedContents[0]);
|
||||
}
|
||||
|
||||
public function testNestedLiteralOpeningDelimiter()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description containing {@internal inline tag that has { that
|
||||
is literal}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description containing ',
|
||||
$parsedContents[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame('.', $parsedContents[2]);
|
||||
|
||||
$this->assertSame(
|
||||
array('inline tag that has { that
|
||||
is literal'),
|
||||
$parsedContents[1]->getParsedDescription()
|
||||
);
|
||||
}
|
||||
|
||||
public function testLiteralClosingDelimiter()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with {} that is not a tag.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(1, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description with } that is not a tag.',
|
||||
$parsedContents[0]
|
||||
);
|
||||
}
|
||||
|
||||
public function testNestedLiteralClosingDelimiter()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with {@internal inline tag with {} that is not an
|
||||
inline tag}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description with ',
|
||||
$parsedContents[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame('.', $parsedContents[2]);
|
||||
|
||||
$this->assertSame(
|
||||
array('inline tag with } that is not an
|
||||
inline tag'),
|
||||
$parsedContents[1]->getParsedDescription()
|
||||
);
|
||||
}
|
||||
|
||||
public function testInlineTagEscapingSequence()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with literal {{@}link}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(1, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description with literal {@link}.',
|
||||
$parsedContents[0]
|
||||
);
|
||||
}
|
||||
|
||||
public function testNestedInlineTagEscapingSequence()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with an {@internal inline tag with literal
|
||||
{{@}link{} in it}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description with an ',
|
||||
$parsedContents[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame('.', $parsedContents[2]);
|
||||
|
||||
$this->assertSame(
|
||||
array('inline tag with literal
|
||||
{@link} in it'),
|
||||
$parsedContents[1]->getParsedDescription()
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Covers Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\CoversTag
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class CoversTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\CoversTag can create
|
||||
* a link for the covers doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exReference
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\CoversTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exReference
|
||||
) {
|
||||
$tag = new CoversTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exReference, $tag->getReference());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exReference
|
||||
return array(
|
||||
array(
|
||||
'covers',
|
||||
'Foo::bar()',
|
||||
'Foo::bar()',
|
||||
'',
|
||||
'Foo::bar()'
|
||||
),
|
||||
array(
|
||||
'covers',
|
||||
'Foo::bar() Testing',
|
||||
'Foo::bar() Testing',
|
||||
'Testing',
|
||||
'Foo::bar()',
|
||||
),
|
||||
array(
|
||||
'covers',
|
||||
'Foo::bar() Testing comments',
|
||||
'Foo::bar() Testing comments',
|
||||
'Testing comments',
|
||||
'Foo::bar()',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Deprecated Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class DeprecatedTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create
|
||||
* a link for the @deprecated doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exDescription
|
||||
* @param string $exVersion
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exVersion
|
||||
) {
|
||||
$tag = new DeprecatedTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exVersion, $tag->getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exVersion
|
||||
return array(
|
||||
array(
|
||||
'deprecated',
|
||||
'1.0 First release.',
|
||||
'1.0 First release.',
|
||||
'First release.',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'deprecated',
|
||||
"1.0\nFirst release.",
|
||||
"1.0\nFirst release.",
|
||||
'First release.',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'deprecated',
|
||||
"1.0\nFirst\nrelease.",
|
||||
"1.0\nFirst\nrelease.",
|
||||
"First\nrelease.",
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'deprecated',
|
||||
'Unfinished release',
|
||||
'Unfinished release',
|
||||
'Unfinished release',
|
||||
''
|
||||
),
|
||||
array(
|
||||
'deprecated',
|
||||
'1.0',
|
||||
'1.0',
|
||||
'',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'deprecated',
|
||||
'GIT: $Id$',
|
||||
'GIT: $Id$',
|
||||
'',
|
||||
'GIT: $Id$'
|
||||
),
|
||||
array(
|
||||
'deprecated',
|
||||
'GIT: $Id$ Dev build',
|
||||
'GIT: $Id$ Dev build',
|
||||
'Dev build',
|
||||
'GIT: $Id$'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,203 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Example Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\ExampleTag
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class ExampleTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\SourceTag can
|
||||
* understand the @source DocBlock.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exStartingLine
|
||||
* @param string $exLineCount
|
||||
* @param string $exFilepath
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ExampleTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exStartingLine,
|
||||
$exLineCount,
|
||||
$exFilePath
|
||||
) {
|
||||
$tag = new ExampleTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exStartingLine, $tag->getStartingLine());
|
||||
$this->assertEquals($exLineCount, $tag->getLineCount());
|
||||
$this->assertEquals($exFilePath, $tag->getFilePath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type,
|
||||
// $content,
|
||||
// $exContent,
|
||||
// $exDescription,
|
||||
// $exStartingLine,
|
||||
// $exLineCount,
|
||||
// $exFilePath
|
||||
return array(
|
||||
array(
|
||||
'example',
|
||||
'file.php',
|
||||
'file.php',
|
||||
'',
|
||||
1,
|
||||
null,
|
||||
'file.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'Testing comments',
|
||||
'Testing comments',
|
||||
'comments',
|
||||
1,
|
||||
null,
|
||||
'Testing'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'file.php 2 Testing',
|
||||
'file.php 2 Testing',
|
||||
'Testing',
|
||||
2,
|
||||
null,
|
||||
'file.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'file.php 2 3 Testing comments',
|
||||
'file.php 2 3 Testing comments',
|
||||
'Testing comments',
|
||||
2,
|
||||
3,
|
||||
'file.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'file.php 2 -1 Testing comments',
|
||||
'file.php 2 -1 Testing comments',
|
||||
'-1 Testing comments',
|
||||
2,
|
||||
null,
|
||||
'file.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'file.php -1 1 Testing comments',
|
||||
'file.php -1 1 Testing comments',
|
||||
'-1 1 Testing comments',
|
||||
1,
|
||||
null,
|
||||
'file.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'"file with spaces.php" Testing comments',
|
||||
'"file with spaces.php" Testing comments',
|
||||
'Testing comments',
|
||||
1,
|
||||
null,
|
||||
'file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'"file with spaces.php" 2 Testing comments',
|
||||
'"file with spaces.php" 2 Testing comments',
|
||||
'Testing comments',
|
||||
2,
|
||||
null,
|
||||
'file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'"file with spaces.php" 2 3 Testing comments',
|
||||
'"file with spaces.php" 2 3 Testing comments',
|
||||
'Testing comments',
|
||||
2,
|
||||
3,
|
||||
'file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'"file with spaces.php" 2 -3 Testing comments',
|
||||
'"file with spaces.php" 2 -3 Testing comments',
|
||||
'-3 Testing comments',
|
||||
2,
|
||||
null,
|
||||
'file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'"file with spaces.php" -2 3 Testing comments',
|
||||
'"file with spaces.php" -2 3 Testing comments',
|
||||
'-2 3 Testing comments',
|
||||
1,
|
||||
null,
|
||||
'file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'file%20with%20spaces.php Testing comments',
|
||||
'file%20with%20spaces.php Testing comments',
|
||||
'Testing comments',
|
||||
1,
|
||||
null,
|
||||
'file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'folder/file%20with%20spaces.php Testing comments',
|
||||
'folder/file%20with%20spaces.php Testing comments',
|
||||
'Testing comments',
|
||||
1,
|
||||
null,
|
||||
'folder/file with spaces.php'
|
||||
),
|
||||
array(
|
||||
'example',
|
||||
'http://example.com/file%20with%20spaces.php Testing comments',
|
||||
'http://example.com/file%20with%20spaces.php Testing comments',
|
||||
'Testing comments',
|
||||
1,
|
||||
null,
|
||||
'http://example.com/file%20with%20spaces.php'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Link Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Ben Selby <benmatselby@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\LinkTag
|
||||
*
|
||||
* @author Ben Selby <benmatselby@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class LinkTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create
|
||||
* a link for the @link doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exDescription
|
||||
* @param string $exLink
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\LinkTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exLink
|
||||
) {
|
||||
$tag = new LinkTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exLink, $tag->getLink());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exLink
|
||||
return array(
|
||||
array(
|
||||
'link',
|
||||
'http://www.phpdoc.org/',
|
||||
'http://www.phpdoc.org/',
|
||||
'http://www.phpdoc.org/',
|
||||
'http://www.phpdoc.org/'
|
||||
),
|
||||
array(
|
||||
'link',
|
||||
'http://www.phpdoc.org/ Testing',
|
||||
'http://www.phpdoc.org/ Testing',
|
||||
'Testing',
|
||||
'http://www.phpdoc.org/'
|
||||
),
|
||||
array(
|
||||
'link',
|
||||
'http://www.phpdoc.org/ Testing comments',
|
||||
'http://www.phpdoc.org/ Testing comments',
|
||||
'Testing comments',
|
||||
'http://www.phpdoc.org/'
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Method Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\MethodTag
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class MethodTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @param string $signature The signature to test.
|
||||
* @param bool $valid Whether the given signature is expected to
|
||||
* be valid.
|
||||
* @param string $expected_name The method name that is expected from this
|
||||
* signature.
|
||||
* @param string $expected_return The return type that is expected from this
|
||||
* signature.
|
||||
* @param bool $paramCount Number of parameters in the signature.
|
||||
* @param string $description The short description mentioned in the
|
||||
* signature.
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\MethodTag
|
||||
* @dataProvider getTestSignatures
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstruct(
|
||||
$signature,
|
||||
$valid,
|
||||
$expected_name,
|
||||
$expected_return,
|
||||
$expected_isStatic,
|
||||
$paramCount,
|
||||
$description
|
||||
) {
|
||||
ob_start();
|
||||
$tag = new MethodTag('method', $signature);
|
||||
$stdout = ob_get_clean();
|
||||
|
||||
$this->assertSame(
|
||||
$valid,
|
||||
empty($stdout),
|
||||
'No error should have been output if the signature is valid'
|
||||
);
|
||||
|
||||
if (!$valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->assertEquals($expected_name, $tag->getMethodName());
|
||||
$this->assertEquals($expected_return, $tag->getType());
|
||||
$this->assertEquals($description, $tag->getDescription());
|
||||
$this->assertEquals($expected_isStatic, $tag->isStatic());
|
||||
$this->assertCount($paramCount, $tag->getArguments());
|
||||
}
|
||||
|
||||
public function getTestSignatures()
|
||||
{
|
||||
return array(
|
||||
// TODO: Verify this case
|
||||
// array(
|
||||
// 'foo',
|
||||
// false, 'foo', '', false, 0, ''
|
||||
// ),
|
||||
array(
|
||||
'foo()',
|
||||
true, 'foo', 'void', false, 0, ''
|
||||
),
|
||||
array(
|
||||
'foo() description',
|
||||
true, 'foo', 'void', false, 0, 'description'
|
||||
),
|
||||
array(
|
||||
'int foo()',
|
||||
true, 'foo', 'int', false, 0, ''
|
||||
),
|
||||
array(
|
||||
'int foo() description',
|
||||
true, 'foo', 'int', false, 0, 'description'
|
||||
),
|
||||
array(
|
||||
'int foo($a, $b)',
|
||||
true, 'foo', 'int', false, 2, ''
|
||||
),
|
||||
array(
|
||||
'int foo() foo(int $a, int $b)',
|
||||
true, 'foo', 'int', false, 2, ''
|
||||
),
|
||||
array(
|
||||
'int foo(int $a, int $b)',
|
||||
true, 'foo', 'int', false, 2, ''
|
||||
),
|
||||
array(
|
||||
'null|int foo(int $a, int $b)',
|
||||
true, 'foo', 'null|int', false, 2, ''
|
||||
),
|
||||
array(
|
||||
'int foo(null|int $a, int $b)',
|
||||
true, 'foo', 'int', false, 2, ''
|
||||
),
|
||||
array(
|
||||
'\Exception foo() foo(Exception $a, Exception $b)',
|
||||
true, 'foo', '\Exception', false, 2, ''
|
||||
),
|
||||
array(
|
||||
'int foo() foo(Exception $a, Exception $b) description',
|
||||
true, 'foo', 'int', false, 2, 'description'
|
||||
),
|
||||
array(
|
||||
'int foo() foo(\Exception $a, \Exception $b) description',
|
||||
true, 'foo', 'int', false, 2, 'description'
|
||||
),
|
||||
array(
|
||||
'void()',
|
||||
true, 'void', 'void', false, 0, ''
|
||||
),
|
||||
array(
|
||||
'static foo()',
|
||||
true, 'foo', 'static', false, 0, ''
|
||||
),
|
||||
array(
|
||||
'static void foo()',
|
||||
true, 'foo', 'void', true, 0, ''
|
||||
),
|
||||
array(
|
||||
'static static foo()',
|
||||
true, 'foo', 'static', true, 0, ''
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Param tag test.
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\ParamTag
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class ParamTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\ParamTag can
|
||||
* understand the @param DocBlock.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $extractedType
|
||||
* @param string $extractedTypes
|
||||
* @param string $extractedVarName
|
||||
* @param string $extractedDescription
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ParamTag
|
||||
* @dataProvider provideDataForConstructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParsesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$extractedType,
|
||||
$extractedTypes,
|
||||
$extractedVarName,
|
||||
$extractedDescription
|
||||
) {
|
||||
$tag = new ParamTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($extractedType, $tag->getType());
|
||||
$this->assertEquals($extractedTypes, $tag->getTypes());
|
||||
$this->assertEquals($extractedVarName, $tag->getVariableName());
|
||||
$this->assertEquals($extractedDescription, $tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParsesInputsIntoCorrectFields()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstructor()
|
||||
{
|
||||
return array(
|
||||
array('param', 'int', 'int', array('int'), '', ''),
|
||||
array('param', '$bob', '', array(), '$bob', ''),
|
||||
array(
|
||||
'param',
|
||||
'int Number of bobs',
|
||||
'int',
|
||||
array('int'),
|
||||
'',
|
||||
'Number of bobs'
|
||||
),
|
||||
array(
|
||||
'param',
|
||||
'int $bob',
|
||||
'int',
|
||||
array('int'),
|
||||
'$bob',
|
||||
''
|
||||
),
|
||||
array(
|
||||
'param',
|
||||
'int $bob Number of bobs',
|
||||
'int',
|
||||
array('int'),
|
||||
'$bob',
|
||||
'Number of bobs'
|
||||
),
|
||||
array(
|
||||
'param',
|
||||
"int Description \n on multiple lines",
|
||||
'int',
|
||||
array('int'),
|
||||
'',
|
||||
"Description \n on multiple lines"
|
||||
),
|
||||
array(
|
||||
'param',
|
||||
"int \n\$bob Variable name on a new line",
|
||||
'int',
|
||||
array('int'),
|
||||
'$bob',
|
||||
"Variable name on a new line"
|
||||
),
|
||||
array(
|
||||
'param',
|
||||
"\nint \$bob Type on a new line",
|
||||
'int',
|
||||
array('int'),
|
||||
'$bob',
|
||||
"Type on a new line"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Return tag test.
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\ReturnTag
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class ReturnTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\ReturnTag can
|
||||
* understand the @return DocBlock.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $extractedType
|
||||
* @param string $extractedTypes
|
||||
* @param string $extractedDescription
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ReturnTag
|
||||
* @dataProvider provideDataForConstructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParsesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$extractedType,
|
||||
$extractedTypes,
|
||||
$extractedDescription
|
||||
) {
|
||||
$tag = new ReturnTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($extractedType, $tag->getType());
|
||||
$this->assertEquals($extractedTypes, $tag->getTypes());
|
||||
$this->assertEquals($extractedDescription, $tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParsesInputsIntoCorrectFields()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstructor()
|
||||
{
|
||||
return array(
|
||||
array('return', '', '', array(), ''),
|
||||
array('return', 'int', 'int', array('int'), ''),
|
||||
array(
|
||||
'return',
|
||||
'int Number of Bobs',
|
||||
'int',
|
||||
array('int'),
|
||||
'Number of Bobs'
|
||||
),
|
||||
array(
|
||||
'return',
|
||||
'int|double Number of Bobs',
|
||||
'int|double',
|
||||
array('int', 'double'),
|
||||
'Number of Bobs'
|
||||
),
|
||||
array(
|
||||
'return',
|
||||
"int Number of \n Bobs",
|
||||
'int',
|
||||
array('int'),
|
||||
"Number of \n Bobs"
|
||||
),
|
||||
array(
|
||||
'return',
|
||||
" int Number of Bobs",
|
||||
'int',
|
||||
array('int'),
|
||||
"Number of Bobs"
|
||||
),
|
||||
array(
|
||||
'return',
|
||||
"int\nNumber of Bobs",
|
||||
'int',
|
||||
array('int'),
|
||||
"Number of Bobs"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor See Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\SeeTag
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class SeeTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the phpDocumentor_Reflection_DocBlock_Tag_See can create a link
|
||||
* for the @see doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exReference
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SeeTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exReference
|
||||
) {
|
||||
$tag = new SeeTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exReference, $tag->getReference());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exReference
|
||||
return array(
|
||||
array(
|
||||
'see',
|
||||
'Foo::bar()',
|
||||
'Foo::bar()',
|
||||
'',
|
||||
'Foo::bar()'
|
||||
),
|
||||
array(
|
||||
'see',
|
||||
'Foo::bar() Testing',
|
||||
'Foo::bar() Testing',
|
||||
'Testing',
|
||||
'Foo::bar()',
|
||||
),
|
||||
array(
|
||||
'see',
|
||||
'Foo::bar() Testing comments',
|
||||
'Foo::bar() Testing comments',
|
||||
'Testing comments',
|
||||
'Foo::bar()',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Since Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\SinceTag
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class SinceTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create
|
||||
* a link for the @since doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exDescription
|
||||
* @param string $exVersion
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SinceTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exVersion
|
||||
) {
|
||||
$tag = new SinceTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exVersion, $tag->getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exVersion
|
||||
return array(
|
||||
array(
|
||||
'since',
|
||||
'1.0 First release.',
|
||||
'1.0 First release.',
|
||||
'First release.',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'since',
|
||||
"1.0\nFirst release.",
|
||||
"1.0\nFirst release.",
|
||||
'First release.',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'since',
|
||||
"1.0\nFirst\nrelease.",
|
||||
"1.0\nFirst\nrelease.",
|
||||
"First\nrelease.",
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'since',
|
||||
'Unfinished release',
|
||||
'Unfinished release',
|
||||
'Unfinished release',
|
||||
''
|
||||
),
|
||||
array(
|
||||
'since',
|
||||
'1.0',
|
||||
'1.0',
|
||||
'',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'since',
|
||||
'GIT: $Id$',
|
||||
'GIT: $Id$',
|
||||
'',
|
||||
'GIT: $Id$'
|
||||
),
|
||||
array(
|
||||
'since',
|
||||
'GIT: $Id$ Dev build',
|
||||
'GIT: $Id$ Dev build',
|
||||
'Dev build',
|
||||
'GIT: $Id$'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Source Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\SourceTag
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class SourceTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\SourceTag can
|
||||
* understand the @source DocBlock.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exStartingLine
|
||||
* @param string $exLineCount
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SourceTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exStartingLine,
|
||||
$exLineCount
|
||||
) {
|
||||
$tag = new SourceTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exStartingLine, $tag->getStartingLine());
|
||||
$this->assertEquals($exLineCount, $tag->getLineCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exStartingLine, $exLineCount
|
||||
return array(
|
||||
array(
|
||||
'source',
|
||||
'2',
|
||||
'2',
|
||||
'',
|
||||
2,
|
||||
null
|
||||
),
|
||||
array(
|
||||
'source',
|
||||
'Testing',
|
||||
'Testing',
|
||||
'Testing',
|
||||
1,
|
||||
null
|
||||
),
|
||||
array(
|
||||
'source',
|
||||
'2 Testing',
|
||||
'2 Testing',
|
||||
'Testing',
|
||||
2,
|
||||
null
|
||||
),
|
||||
array(
|
||||
'source',
|
||||
'2 3 Testing comments',
|
||||
'2 3 Testing comments',
|
||||
'Testing comments',
|
||||
2,
|
||||
3
|
||||
),
|
||||
array(
|
||||
'source',
|
||||
'2 -1 Testing comments',
|
||||
'2 -1 Testing comments',
|
||||
'-1 Testing comments',
|
||||
2,
|
||||
null
|
||||
),
|
||||
array(
|
||||
'source',
|
||||
'-1 1 Testing comments',
|
||||
'-1 1 Testing comments',
|
||||
'-1 1 Testing comments',
|
||||
1,
|
||||
null
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Throws tag test.
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\ThrowsTag
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class ThrowsTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag can
|
||||
* understand the @throws DocBlock.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $extractedType
|
||||
* @param string $extractedTypes
|
||||
* @param string $extractedDescription
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag
|
||||
* @dataProvider provideDataForConstructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParsesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$extractedType,
|
||||
$extractedTypes,
|
||||
$extractedDescription
|
||||
) {
|
||||
$tag = new ThrowsTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($extractedType, $tag->getType());
|
||||
$this->assertEquals($extractedTypes, $tag->getTypes());
|
||||
$this->assertEquals($extractedDescription, $tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParsesInputsIntoCorrectFields()
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstructor()
|
||||
{
|
||||
return array(
|
||||
array('throws', '', '', array(), ''),
|
||||
array('throws', 'int', 'int', array('int'), ''),
|
||||
array(
|
||||
'throws',
|
||||
'int Number of Bobs',
|
||||
'int',
|
||||
array('int'),
|
||||
'Number of Bobs'
|
||||
),
|
||||
array(
|
||||
'throws',
|
||||
'int|double Number of Bobs',
|
||||
'int|double',
|
||||
array('int', 'double'),
|
||||
'Number of Bobs'
|
||||
),
|
||||
array(
|
||||
'throws',
|
||||
"int Number of \n Bobs",
|
||||
'int',
|
||||
array('int'),
|
||||
"Number of \n Bobs"
|
||||
),
|
||||
array(
|
||||
'throws',
|
||||
" int Number of Bobs",
|
||||
'int',
|
||||
array('int'),
|
||||
"Number of Bobs"
|
||||
),
|
||||
array(
|
||||
'throws',
|
||||
"int\nNumber of Bobs",
|
||||
'int',
|
||||
array('int'),
|
||||
"Number of Bobs"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Uses Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\UsesTag
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class UsesTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\UsesTag can create
|
||||
* a link for the @uses doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exReference
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\UsesTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exReference
|
||||
) {
|
||||
$tag = new UsesTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exReference, $tag->getReference());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exReference
|
||||
return array(
|
||||
array(
|
||||
'uses',
|
||||
'Foo::bar()',
|
||||
'Foo::bar()',
|
||||
'',
|
||||
'Foo::bar()'
|
||||
),
|
||||
array(
|
||||
'uses',
|
||||
'Foo::bar() Testing',
|
||||
'Foo::bar() Testing',
|
||||
'Testing',
|
||||
'Foo::bar()',
|
||||
),
|
||||
array(
|
||||
'uses',
|
||||
'Foo::bar() Testing comments',
|
||||
'Foo::bar() Testing comments',
|
||||
'Testing comments',
|
||||
'Foo::bar()',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Var Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\VarTag
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class VarTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\VarTag can
|
||||
* understand the @var doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exType
|
||||
* @param string $exVariable
|
||||
* @param string $exDescription
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\VarTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exType,
|
||||
$exVariable,
|
||||
$exDescription
|
||||
) {
|
||||
$tag = new VarTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exType, $tag->getType());
|
||||
$this->assertEquals($exVariable, $tag->getVariableName());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exType, $exVariable, $exDescription
|
||||
return array(
|
||||
array(
|
||||
'var',
|
||||
'int',
|
||||
'int',
|
||||
'',
|
||||
''
|
||||
),
|
||||
array(
|
||||
'var',
|
||||
'int $bob',
|
||||
'int',
|
||||
'$bob',
|
||||
''
|
||||
),
|
||||
array(
|
||||
'var',
|
||||
'int $bob Number of bobs',
|
||||
'int',
|
||||
'$bob',
|
||||
'Number of bobs'
|
||||
),
|
||||
array(
|
||||
'var',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
''
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Version Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\VersionTag
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class VersionTagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\LinkTag can create
|
||||
* a link for the @version doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exContent
|
||||
* @param string $exDescription
|
||||
* @param string $exVersion
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag\VersionTag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exContent,
|
||||
$exDescription,
|
||||
$exVersion
|
||||
) {
|
||||
$tag = new VersionTag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
$this->assertEquals($exVersion, $tag->getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exContent, $exDescription, $exVersion
|
||||
return array(
|
||||
array(
|
||||
'version',
|
||||
'1.0 First release.',
|
||||
'1.0 First release.',
|
||||
'First release.',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'version',
|
||||
"1.0\nFirst release.",
|
||||
"1.0\nFirst release.",
|
||||
'First release.',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'version',
|
||||
"1.0\nFirst\nrelease.",
|
||||
"1.0\nFirst\nrelease.",
|
||||
"First\nrelease.",
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'version',
|
||||
'Unfinished release',
|
||||
'Unfinished release',
|
||||
'Unfinished release',
|
||||
''
|
||||
),
|
||||
array(
|
||||
'version',
|
||||
'1.0',
|
||||
'1.0',
|
||||
'',
|
||||
'1.0'
|
||||
),
|
||||
array(
|
||||
'version',
|
||||
'GIT: $Id$',
|
||||
'GIT: $Id$',
|
||||
'',
|
||||
'GIT: $Id$'
|
||||
),
|
||||
array(
|
||||
'version',
|
||||
'GIT: $Id$ Dev build',
|
||||
'GIT: $Id$ Dev build',
|
||||
'Dev build',
|
||||
'GIT: $Id$'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
313
vendor/phpdocumentor/reflection-docblock/tests/phpDocumentor/Reflection/DocBlock/TagTest.php
vendored
Normal file
313
vendor/phpdocumentor/reflection-docblock/tests/phpDocumentor/Reflection/DocBlock/TagTest.php
vendored
Normal file
|
@ -0,0 +1,313 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Var Tag Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock;
|
||||
use phpDocumentor\Reflection\DocBlock\Context;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\VarTag
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class TagTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testInvalidTagLine()
|
||||
{
|
||||
Tag::createInstance('Invalid tag line');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testTagHandlerUnregistration()
|
||||
{
|
||||
$currentHandler = __NAMESPACE__ . '\Tag\VarTag';
|
||||
$tagPreUnreg = Tag::createInstance('@var mixed');
|
||||
$this->assertInstanceOf(
|
||||
$currentHandler,
|
||||
$tagPreUnreg
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$tagPreUnreg
|
||||
);
|
||||
|
||||
Tag::registerTagHandler('var', null);
|
||||
|
||||
$tagPostUnreg = Tag::createInstance('@var mixed');
|
||||
$this->assertNotInstanceOf(
|
||||
$currentHandler,
|
||||
$tagPostUnreg
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$tagPostUnreg
|
||||
);
|
||||
|
||||
Tag::registerTagHandler('var', $currentHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testTagHandlerCorrectRegistration()
|
||||
{
|
||||
if (0 == ini_get('allow_url_include')) {
|
||||
$this->markTestSkipped('"data" URIs for includes are required.');
|
||||
}
|
||||
$currentHandler = __NAMESPACE__ . '\Tag\VarTag';
|
||||
$tagPreReg = Tag::createInstance('@var mixed');
|
||||
$this->assertInstanceOf(
|
||||
$currentHandler,
|
||||
$tagPreReg
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$tagPreReg
|
||||
);
|
||||
|
||||
include 'data:text/plain;base64,'. base64_encode(
|
||||
<<<TAG_HANDLER
|
||||
<?php
|
||||
class MyTagHandler extends \phpDocumentor\Reflection\DocBlock\Tag {}
|
||||
TAG_HANDLER
|
||||
);
|
||||
|
||||
$this->assertTrue(Tag::registerTagHandler('var', '\MyTagHandler'));
|
||||
|
||||
$tagPostReg = Tag::createInstance('@var mixed');
|
||||
$this->assertNotInstanceOf(
|
||||
$currentHandler,
|
||||
$tagPostReg
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$tagPostReg
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
'\MyTagHandler',
|
||||
$tagPostReg
|
||||
);
|
||||
|
||||
$this->assertTrue(Tag::registerTagHandler('var', $currentHandler));
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testTagHandlerCorrectRegistration
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag::createInstance
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testNamespacedTagHandlerCorrectRegistration()
|
||||
{
|
||||
$tagPreReg = Tag::createInstance('@T something');
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$tagPreReg
|
||||
);
|
||||
$this->assertNotInstanceOf(
|
||||
'\MyTagHandler',
|
||||
$tagPreReg
|
||||
);
|
||||
|
||||
$this->assertTrue(
|
||||
Tag::registerTagHandler('\MyNamespace\MyTag', '\MyTagHandler')
|
||||
);
|
||||
|
||||
$tagPostReg = Tag::createInstance(
|
||||
'@T something',
|
||||
new DocBlock(
|
||||
'',
|
||||
new Context('', array('T' => '\MyNamespace\MyTag'))
|
||||
)
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$tagPostReg
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
'\MyTagHandler',
|
||||
$tagPostReg
|
||||
);
|
||||
|
||||
$this->assertTrue(
|
||||
Tag::registerTagHandler('\MyNamespace\MyTag', null)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testTagHandlerCorrectRegistration
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag::createInstance
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testNamespacedTagHandlerIncorrectRegistration()
|
||||
{
|
||||
$tagPreReg = Tag::createInstance('@T something');
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$tagPreReg
|
||||
);
|
||||
$this->assertNotInstanceOf(
|
||||
'\MyTagHandler',
|
||||
$tagPreReg
|
||||
);
|
||||
|
||||
$this->assertFalse(
|
||||
Tag::registerTagHandler('MyNamespace\MyTag', '\MyTagHandler')
|
||||
);
|
||||
|
||||
$tagPostReg = Tag::createInstance(
|
||||
'@T something',
|
||||
new DocBlock(
|
||||
'',
|
||||
new Context('', array('T' => '\MyNamespace\MyTag'))
|
||||
)
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$tagPostReg
|
||||
);
|
||||
$this->assertNotInstanceOf(
|
||||
'\MyTagHandler',
|
||||
$tagPostReg
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testNonExistentTagHandlerRegistration()
|
||||
{
|
||||
$currentHandler = __NAMESPACE__ . '\Tag\VarTag';
|
||||
$tagPreReg = Tag::createInstance('@var mixed');
|
||||
$this->assertInstanceOf(
|
||||
$currentHandler,
|
||||
$tagPreReg
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$tagPreReg
|
||||
);
|
||||
|
||||
$this->assertFalse(Tag::registerTagHandler('var', 'Non existent'));
|
||||
|
||||
$tagPostReg = Tag::createInstance('@var mixed');
|
||||
$this->assertInstanceOf(
|
||||
$currentHandler,
|
||||
$tagPostReg
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$tagPostReg
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag::registerTagHandler
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testIncompatibleTagHandlerRegistration()
|
||||
{
|
||||
$currentHandler = __NAMESPACE__ . '\Tag\VarTag';
|
||||
$tagPreReg = Tag::createInstance('@var mixed');
|
||||
$this->assertInstanceOf(
|
||||
$currentHandler,
|
||||
$tagPreReg
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$tagPreReg
|
||||
);
|
||||
|
||||
$this->assertFalse(
|
||||
Tag::registerTagHandler('var', __NAMESPACE__ . '\TagTest')
|
||||
);
|
||||
|
||||
$tagPostReg = Tag::createInstance('@var mixed');
|
||||
$this->assertInstanceOf(
|
||||
$currentHandler,
|
||||
$tagPostReg
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$tagPostReg
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\VarTag can
|
||||
* understand the @var doc block.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @param string $exDescription
|
||||
*
|
||||
* @covers \phpDocumentor\Reflection\DocBlock\Tag
|
||||
* @dataProvider provideDataForConstuctor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructorParesInputsIntoCorrectFields(
|
||||
$type,
|
||||
$content,
|
||||
$exDescription
|
||||
) {
|
||||
$tag = new Tag($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($content, $tag->getContent());
|
||||
$this->assertEquals($exDescription, $tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testConstructorParesInputsIntoCorrectFields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provideDataForConstuctor()
|
||||
{
|
||||
// $type, $content, $exDescription
|
||||
return array(
|
||||
array(
|
||||
'unknown',
|
||||
'some content',
|
||||
'some content',
|
||||
),
|
||||
array(
|
||||
'unknown',
|
||||
'',
|
||||
'',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,253 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor Collection Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Type;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Context;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Type\Collection
|
||||
*
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class CollectionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::getContext
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstruct()
|
||||
{
|
||||
$collection = new Collection();
|
||||
$this->assertCount(0, $collection);
|
||||
$this->assertEquals('', $collection->getContext()->getNamespace());
|
||||
$this->assertCount(0, $collection->getContext()->getNamespaceAliases());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructWithTypes()
|
||||
{
|
||||
$collection = new Collection(array('integer', 'string'));
|
||||
$this->assertCount(2, $collection);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructWithNamespace()
|
||||
{
|
||||
$collection = new Collection(array(), new Context('\My\Space'));
|
||||
$this->assertEquals('My\Space', $collection->getContext()->getNamespace());
|
||||
|
||||
$collection = new Collection(array(), new Context('My\Space'));
|
||||
$this->assertEquals('My\Space', $collection->getContext()->getNamespace());
|
||||
|
||||
$collection = new Collection(array(), null);
|
||||
$this->assertEquals('', $collection->getContext()->getNamespace());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructWithNamespaceAliases()
|
||||
{
|
||||
$fixture = array('a' => 'b');
|
||||
$collection = new Collection(array(), new Context(null, $fixture));
|
||||
$this->assertEquals(
|
||||
array('a' => '\b'),
|
||||
$collection->getContext()->getNamespaceAliases()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fixture
|
||||
* @param array $expected
|
||||
*
|
||||
* @dataProvider provideTypesToExpand
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAdd($fixture, $expected)
|
||||
{
|
||||
$collection = new Collection(
|
||||
array(),
|
||||
new Context('\My\Space', array('Alias' => '\My\Space\Aliasing'))
|
||||
);
|
||||
$collection->add($fixture);
|
||||
|
||||
$this->assertSame($expected, $collection->getArrayCopy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fixture
|
||||
* @param array $expected
|
||||
*
|
||||
* @dataProvider provideTypesToExpandWithoutNamespace
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddWithoutNamespace($fixture, $expected)
|
||||
{
|
||||
$collection = new Collection(
|
||||
array(),
|
||||
new Context(null, array('Alias' => '\My\Space\Aliasing'))
|
||||
);
|
||||
$collection->add($fixture);
|
||||
|
||||
$this->assertSame($expected, $collection->getArrayCopy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fixture
|
||||
* @param array $expected
|
||||
*
|
||||
* @dataProvider provideTypesToExpandWithPropertyOrMethod
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddMethodsAndProperties($fixture, $expected)
|
||||
{
|
||||
$collection = new Collection(
|
||||
array(),
|
||||
new Context(null, array('LinkDescriptor' => '\phpDocumentor\LinkDescriptor'))
|
||||
);
|
||||
$collection->add($fixture);
|
||||
|
||||
$this->assertSame($expected, $collection->getArrayCopy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add
|
||||
* @expectedException InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddWithInvalidArgument()
|
||||
{
|
||||
$collection = new Collection();
|
||||
$collection->add(array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the types and their expected values to test the retrieval of
|
||||
* types.
|
||||
*
|
||||
* @param string $method Name of the method consuming this data provider.
|
||||
* @param string $namespace Name of the namespace to user as basis.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function provideTypesToExpand($method, $namespace = '\My\Space\\')
|
||||
{
|
||||
return array(
|
||||
array('', array()),
|
||||
array(' ', array()),
|
||||
array('int', array('int')),
|
||||
array('int ', array('int')),
|
||||
array('string', array('string')),
|
||||
array('DocBlock', array($namespace.'DocBlock')),
|
||||
array('DocBlock[]', array($namespace.'DocBlock[]')),
|
||||
array(' DocBlock ', array($namespace.'DocBlock')),
|
||||
array('\My\Space\DocBlock', array('\My\Space\DocBlock')),
|
||||
array('Alias\DocBlock', array('\My\Space\Aliasing\DocBlock')),
|
||||
array(
|
||||
'DocBlock|Tag',
|
||||
array($namespace .'DocBlock', $namespace .'Tag')
|
||||
),
|
||||
array(
|
||||
'DocBlock|null',
|
||||
array($namespace.'DocBlock', 'null')
|
||||
),
|
||||
array(
|
||||
'\My\Space\DocBlock|Tag',
|
||||
array('\My\Space\DocBlock', $namespace.'Tag')
|
||||
),
|
||||
array(
|
||||
'DocBlock[]|null',
|
||||
array($namespace.'DocBlock[]', 'null')
|
||||
),
|
||||
array(
|
||||
'DocBlock[]|int[]',
|
||||
array($namespace.'DocBlock[]', 'int[]')
|
||||
),
|
||||
array(
|
||||
'LinkDescriptor::setLink()',
|
||||
array($namespace.'LinkDescriptor::setLink()')
|
||||
),
|
||||
array(
|
||||
'Alias\LinkDescriptor::setLink()',
|
||||
array('\My\Space\Aliasing\LinkDescriptor::setLink()')
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the types and their expected values to test the retrieval of
|
||||
* types when no namespace is available.
|
||||
*
|
||||
* @param string $method Name of the method consuming this data provider.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function provideTypesToExpandWithoutNamespace($method)
|
||||
{
|
||||
return $this->provideTypesToExpand($method, '\\');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the method and property types and their expected values to test
|
||||
* the retrieval of types.
|
||||
*
|
||||
* @param string $method Name of the method consuming this data provider.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function provideTypesToExpandWithPropertyOrMethod($method)
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'LinkDescriptor::setLink()',
|
||||
array('\phpDocumentor\LinkDescriptor::setLink()')
|
||||
),
|
||||
array(
|
||||
'phpDocumentor\LinkDescriptor::setLink()',
|
||||
array('\phpDocumentor\LinkDescriptor::setLink()')
|
||||
),
|
||||
array(
|
||||
'LinkDescriptor::$link',
|
||||
array('\phpDocumentor\LinkDescriptor::$link')
|
||||
),
|
||||
array(
|
||||
'phpDocumentor\LinkDescriptor::$link',
|
||||
array('\phpDocumentor\LinkDescriptor::$link')
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
337
vendor/phpdocumentor/reflection-docblock/tests/phpDocumentor/Reflection/DocBlockTest.php
vendored
Normal file
337
vendor/phpdocumentor/reflection-docblock/tests/phpDocumentor/Reflection/DocBlockTest.php
vendored
Normal file
|
@ -0,0 +1,337 @@
|
|||
<?php
|
||||
/**
|
||||
* phpDocumentor DocBlock Test
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Context;
|
||||
use phpDocumentor\Reflection\DocBlock\Location;
|
||||
use phpDocumentor\Reflection\DocBlock\Tag\ReturnTag;
|
||||
|
||||
/**
|
||||
* Test class for phpDocumentor\Reflection\DocBlock
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class DocBlockTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstruct()
|
||||
{
|
||||
$fixture = <<<DOCBLOCK
|
||||
/**
|
||||
* This is a short description
|
||||
*
|
||||
* This is a long description
|
||||
*
|
||||
* @see \MyClass
|
||||
* @return void
|
||||
*/
|
||||
DOCBLOCK;
|
||||
$object = new DocBlock(
|
||||
$fixture,
|
||||
new Context('\MyNamespace', array('PHPDoc' => '\phpDocumentor')),
|
||||
new Location(2)
|
||||
);
|
||||
$this->assertEquals(
|
||||
'This is a short description',
|
||||
$object->getShortDescription()
|
||||
);
|
||||
$this->assertEquals(
|
||||
'This is a long description',
|
||||
$object->getLongDescription()->getContents()
|
||||
);
|
||||
$this->assertCount(2, $object->getTags());
|
||||
$this->assertTrue($object->hasTag('see'));
|
||||
$this->assertTrue($object->hasTag('return'));
|
||||
$this->assertFalse($object->hasTag('category'));
|
||||
|
||||
$this->assertSame('MyNamespace', $object->getContext()->getNamespace());
|
||||
$this->assertSame(
|
||||
array('PHPDoc' => '\phpDocumentor'),
|
||||
$object->getContext()->getNamespaceAliases()
|
||||
);
|
||||
$this->assertSame(2, $object->getLocation()->getLineNumber());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::splitDocBlock
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructWithTagsOnly()
|
||||
{
|
||||
$fixture = <<<DOCBLOCK
|
||||
/**
|
||||
* @see \MyClass
|
||||
* @return void
|
||||
*/
|
||||
DOCBLOCK;
|
||||
$object = new DocBlock($fixture);
|
||||
$this->assertEquals('', $object->getShortDescription());
|
||||
$this->assertEquals('', $object->getLongDescription()->getContents());
|
||||
$this->assertCount(2, $object->getTags());
|
||||
$this->assertTrue($object->hasTag('see'));
|
||||
$this->assertTrue($object->hasTag('return'));
|
||||
$this->assertFalse($object->hasTag('category'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::isTemplateStart
|
||||
*/
|
||||
public function testIfStartOfTemplateIsDiscovered()
|
||||
{
|
||||
$fixture = <<<DOCBLOCK
|
||||
/**#@+
|
||||
* @see \MyClass
|
||||
* @return void
|
||||
*/
|
||||
DOCBLOCK;
|
||||
$object = new DocBlock($fixture);
|
||||
$this->assertEquals('', $object->getShortDescription());
|
||||
$this->assertEquals('', $object->getLongDescription()->getContents());
|
||||
$this->assertCount(2, $object->getTags());
|
||||
$this->assertTrue($object->hasTag('see'));
|
||||
$this->assertTrue($object->hasTag('return'));
|
||||
$this->assertFalse($object->hasTag('category'));
|
||||
$this->assertTrue($object->isTemplateStart());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::isTemplateEnd
|
||||
*/
|
||||
public function testIfEndOfTemplateIsDiscovered()
|
||||
{
|
||||
$fixture = <<<DOCBLOCK
|
||||
/**#@-*/
|
||||
DOCBLOCK;
|
||||
$object = new DocBlock($fixture);
|
||||
$this->assertEquals('', $object->getShortDescription());
|
||||
$this->assertEquals('', $object->getLongDescription()->getContents());
|
||||
$this->assertTrue($object->isTemplateEnd());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::cleanInput
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructOneLiner()
|
||||
{
|
||||
$fixture = '/** Short description and nothing more. */';
|
||||
$object = new DocBlock($fixture);
|
||||
$this->assertEquals(
|
||||
'Short description and nothing more.',
|
||||
$object->getShortDescription()
|
||||
);
|
||||
$this->assertEquals('', $object->getLongDescription()->getContents());
|
||||
$this->assertCount(0, $object->getTags());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::__construct
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructFromReflector()
|
||||
{
|
||||
$object = new DocBlock(new \ReflectionClass($this));
|
||||
$this->assertEquals(
|
||||
'Test class for phpDocumentor\Reflection\DocBlock',
|
||||
$object->getShortDescription()
|
||||
);
|
||||
$this->assertEquals('', $object->getLongDescription()->getContents());
|
||||
$this->assertCount(4, $object->getTags());
|
||||
$this->assertTrue($object->hasTag('author'));
|
||||
$this->assertTrue($object->hasTag('copyright'));
|
||||
$this->assertTrue($object->hasTag('license'));
|
||||
$this->assertTrue($object->hasTag('link'));
|
||||
$this->assertFalse($object->hasTag('category'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExceptionOnInvalidObject()
|
||||
{
|
||||
new DocBlock($this);
|
||||
}
|
||||
|
||||
public function testDotSeperation()
|
||||
{
|
||||
$fixture = <<<DOCBLOCK
|
||||
/**
|
||||
* This is a short description.
|
||||
* This is a long description.
|
||||
* This is a continuation of the long description.
|
||||
*/
|
||||
DOCBLOCK;
|
||||
$object = new DocBlock($fixture);
|
||||
$this->assertEquals(
|
||||
'This is a short description.',
|
||||
$object->getShortDescription()
|
||||
);
|
||||
$this->assertEquals(
|
||||
"This is a long description.\nThis is a continuation of the long "
|
||||
."description.",
|
||||
$object->getLongDescription()->getContents()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::parseTags
|
||||
* @expectedException \LogicException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testInvalidTagBlock()
|
||||
{
|
||||
if (0 == ini_get('allow_url_include')) {
|
||||
$this->markTestSkipped('"data" URIs for includes are required.');
|
||||
}
|
||||
|
||||
include 'data:text/plain;base64,'. base64_encode(
|
||||
<<<DOCBLOCK_EXTENSION
|
||||
<?php
|
||||
class MyReflectionDocBlock extends \phpDocumentor\Reflection\DocBlock {
|
||||
protected function splitDocBlock(\$comment) {
|
||||
return array('', '', 'Invalid tag block');
|
||||
}
|
||||
}
|
||||
DOCBLOCK_EXTENSION
|
||||
);
|
||||
new \MyReflectionDocBlock('');
|
||||
|
||||
}
|
||||
|
||||
public function testTagCaseSensitivity()
|
||||
{
|
||||
$fixture = <<<DOCBLOCK
|
||||
/**
|
||||
* This is a short description.
|
||||
*
|
||||
* This is a long description.
|
||||
*
|
||||
* @method null something()
|
||||
* @Method({"GET", "POST"})
|
||||
*/
|
||||
DOCBLOCK;
|
||||
$object = new DocBlock($fixture);
|
||||
$this->assertEquals(
|
||||
'This is a short description.',
|
||||
$object->getShortDescription()
|
||||
);
|
||||
$this->assertEquals(
|
||||
'This is a long description.',
|
||||
$object->getLongDescription()->getContents()
|
||||
);
|
||||
$tags = $object->getTags();
|
||||
$this->assertCount(2, $tags);
|
||||
$this->assertTrue($object->hasTag('method'));
|
||||
$this->assertTrue($object->hasTag('Method'));
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\DocBlock\Tag\MethodTag',
|
||||
$tags[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\DocBlock\Tag',
|
||||
$tags[1]
|
||||
);
|
||||
$this->assertNotInstanceOf(
|
||||
__NAMESPACE__ . '\DocBlock\Tag\MethodTag',
|
||||
$tags[1]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testConstructFromReflector
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::getTagsByName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetTagsByNameZeroAndOneMatch()
|
||||
{
|
||||
$object = new DocBlock(new \ReflectionClass($this));
|
||||
$this->assertEmpty($object->getTagsByName('category'));
|
||||
$this->assertCount(1, $object->getTagsByName('author'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testConstructWithTagsOnly
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::parseTags
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testParseMultilineTag()
|
||||
{
|
||||
$fixture = <<<DOCBLOCK
|
||||
/**
|
||||
* @return void Content on
|
||||
* multiple lines.
|
||||
*/
|
||||
DOCBLOCK;
|
||||
$object = new DocBlock($fixture);
|
||||
$this->assertCount(1, $object->getTags());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testConstructWithTagsOnly
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::parseTags
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testParseMultilineTagWithLineBreaks()
|
||||
{
|
||||
$fixture = <<<DOCBLOCK
|
||||
/**
|
||||
* @return void Content on
|
||||
* multiple lines.
|
||||
*
|
||||
* One more, after the break.
|
||||
*/
|
||||
DOCBLOCK;
|
||||
$object = new DocBlock($fixture);
|
||||
$this->assertCount(1, $tags = $object->getTags());
|
||||
/** @var ReturnTag $tag */
|
||||
$tag = reset($tags);
|
||||
$this->assertEquals("Content on\n multiple lines.\n\n One more, after the break.", $tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testConstructWithTagsOnly
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::getTagsByName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetTagsByNameMultipleMatch()
|
||||
{
|
||||
$fixture = <<<DOCBLOCK
|
||||
/**
|
||||
* @param string
|
||||
* @param int
|
||||
* @return void
|
||||
*/
|
||||
DOCBLOCK;
|
||||
$object = new DocBlock($fixture);
|
||||
$this->assertEmpty($object->getTagsByName('category'));
|
||||
$this->assertCount(1, $object->getTagsByName('return'));
|
||||
$this->assertCount(2, $object->getTagsByName('param'));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue