Inverted @param and @return hierarchy;

More fixes to tests and code coverage increase.
This commit is contained in:
Vasil Rangelov
2012-11-10 20:27:57 +02:00
parent ad32c225c5
commit 6e1bb192b3
12 changed files with 100 additions and 107 deletions
@@ -32,7 +32,7 @@ class CoversTagTest extends \PHPUnit_Framework_TestCase
* @param string $exContent
* @param string $exReference
*
* @covers \phpDocumentor\Reflection\DocBlock\Tag\CoversTag::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tag\CoversTag
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -40,22 +40,16 @@ class CoversTagTest extends \PHPUnit_Framework_TestCase
public function testConstructorParesInputsIntoCorrectFields(
$type,
$content,
$exName,
$exContent,
$exDescription,
$exReference
) {
$tag = new CoversTag($type, $content);
$actualName = $tag->getName();
$actualContent = $tag->getContent();
$actualDescription = $tag->getDescription();
$actualReference = $tag->getReference();
$this->assertEquals($exName, $actualName);
$this->assertEquals($exContent, $actualContent);
$this->assertEquals($exDescription, $actualDescription);
$this->assertEquals($exReference, $actualReference);
$this->assertEquals($type, $tag->getName());
$this->assertEquals($exContent, $tag->getContent());
$this->assertEquals($exDescription, $tag->getDescription());
$this->assertEquals($exReference, $tag->getReference());
}
/**
@@ -68,25 +62,22 @@ class CoversTagTest extends \PHPUnit_Framework_TestCase
// $type, $content, $exName, $exContent, $exDescription, $exReference
return array(
array(
'uses',
'covers',
'Foo::bar()',
'uses',
'Foo::bar()',
'',
'Foo::bar()'
),
array(
'uses',
'covers',
'Foo::bar() Testing',
'uses',
'Foo::bar() Testing',
'Testing',
'Foo::bar()',
),
array(
'uses',
'covers',
'Foo::bar() Testing comments',
'uses',
'Foo::bar() Testing comments',
'Testing comments',
'Foo::bar()',
@@ -34,6 +34,7 @@ class LinkTagTest extends \PHPUnit_Framework_TestCase
* @param string $exLink
*
* @covers \phpDocumentor\Reflection\DocBlock\Tag\LinkTag::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tag\LinkTag::getLink
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -41,22 +42,16 @@ class LinkTagTest extends \PHPUnit_Framework_TestCase
public function testConstructorParesInputsIntoCorrectFields(
$type,
$content,
$exName,
$exContent,
$exDescription,
$exLink
) {
$tag = new LinkTag($type, $content);
$actualName = $tag->getName();
$actualContent = $tag->getContent();
$actualDescription = $tag->getDescription();
$actualLink = $tag->getLink();
$this->assertEquals($exName, $actualName);
$this->assertEquals($exContent, $actualContent);
$this->assertEquals($exDescription, $actualDescription);
$this->assertEquals($exLink, $actualLink);
$this->assertEquals($type, $tag->getName());
$this->assertEquals($exContent, $tag->getContent());
$this->assertEquals($exDescription, $tag->getDescription());
$this->assertEquals($exLink, $tag->getLink());
}
/**
@@ -71,7 +66,6 @@ class LinkTagTest extends \PHPUnit_Framework_TestCase
array(
'link',
'http://www.phpdoc.org/',
'link',
'http://www.phpdoc.org/',
'http://www.phpdoc.org/',
'http://www.phpdoc.org/'
@@ -79,7 +73,6 @@ class LinkTagTest extends \PHPUnit_Framework_TestCase
array(
'link',
'http://www.phpdoc.org/ Testing',
'link',
'http://www.phpdoc.org/ Testing',
'Testing',
'http://www.phpdoc.org/'
@@ -87,7 +80,6 @@ class LinkTagTest extends \PHPUnit_Framework_TestCase
array(
'link',
'http://www.phpdoc.org/ Testing comments',
'link',
'http://www.phpdoc.org/ Testing comments',
'Testing comments',
'http://www.phpdoc.org/'
@@ -34,6 +34,9 @@ class MethodTagTest extends \PHPUnit_Framework_TestCase
* @param string $description The short description mentioned in the
* signature.
*
* @covers \phpDocumentor\Reflection\DocBlock\Tag\MethodTag::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tag\MethodTag::getMethodName
*
* @dataProvider getTestSignatures
*
* @return void
@@ -33,6 +33,7 @@ class ParamTagTest extends \PHPUnit_Framework_TestCase
* @param string $extractedDescription
*
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ParamTag::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ParamTag::getVariableName
*
* @dataProvider provideDataForConstructor
*
@@ -42,12 +43,15 @@ class ParamTagTest extends \PHPUnit_Framework_TestCase
$type,
$content,
$extractedType,
$extractedTypes,
$extractedVarName,
$extractedDescription
) {
$tag = new ParamTag($type, $content);
$this->assertEquals($extractedType, $tag->getTypes());
$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());
}
@@ -60,15 +64,15 @@ class ParamTagTest extends \PHPUnit_Framework_TestCase
public function provideDataForConstructor()
{
return array(
array('param', 'int', array('int'), '', ''),
array('param', '$bob', array(), '$bob', ''),
array('param', 'int', 'int', array('int'), '', ''),
array('param', '$bob', '', array(), '$bob', ''),
array(
'param', 'int Number of bobs', array('int'), '',
'param', 'int Number of bobs', 'int', array('int'), '',
'Number of bobs'
),
array('param', 'int $bob', array('int'), '$bob', ''),
array('param', 'int $bob', 'int', array('int'), '$bob', ''),
array(
'param', 'int $bob Number of bobs', array('int'), '$bob',
'param', 'int $bob Number of bobs', 'int', array('int'), '$bob',
'Number of bobs'
),
);
@@ -31,19 +31,25 @@ class ReturnTagTest extends ParamTagTest
* @param string $extractedDescription
*
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ReturnTag::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ParamTag::getType
* @covers \phpDocumentor\Reflection\DocBlock\Tag\ParamTag::getTypes
*
* @dataProvider provideDataForConstructor
*
* @return void
*/
public function testConstructorParsesInputsIntoCorrectFields(
$type,
$content,
$extractedType,
$extractedTypes,
$extractedDescription
) {
$tag = new ReturnTag('return', $content);
$tag = new ReturnTag($type, $content);
$this->assertEquals($extractedType, $tag->getTypes());
$this->assertEquals($type, $tag->getName());
$this->assertEquals($extractedType, $tag->getType());
$this->assertEquals($extractedTypes, $tag->getTypes());
$this->assertEquals($extractedDescription, $tag->getDescription());
}
@@ -55,9 +61,15 @@ class ReturnTagTest extends ParamTagTest
public function provideDataForConstructor()
{
return array(
array('', array(), ''),
array('int', array('int'), ''),
array('int Number of Bobs', array('int'), 'Number of Bobs'),
array('return', '', '', array(), ''),
array('return', 'int', 'int', array('int'), ''),
array(
'return',
'int Number of Bobs',
'int',
array('int'),
'Number of Bobs'
),
);
}
}
@@ -33,6 +33,7 @@ class SeeTagTest extends \PHPUnit_Framework_TestCase
* @param string $exReference
*
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SeeTag::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tag\SeeTag::getReference
* @dataProvider provideDataForConstuctor
*
* @return void
@@ -40,22 +41,16 @@ class SeeTagTest extends \PHPUnit_Framework_TestCase
public function testConstructorParesInputsIntoCorrectFields(
$type,
$content,
$exName,
$exContent,
$exDescription,
$exReference
) {
$tag = new SeeTag($type, $content);
$actualName = $tag->getName();
$actualContent = $tag->getContent();
$actualDescription = $tag->getDescription();
$actualReference = $tag->getReference();
$this->assertEquals($exName, $actualName);
$this->assertEquals($exContent, $actualContent);
$this->assertEquals($exDescription, $actualDescription);
$this->assertEquals($exReference, $actualReference);
$this->assertEquals($type, $tag->getName());
$this->assertEquals($exContent, $tag->getContent());
$this->assertEquals($exDescription, $tag->getDescription());
$this->assertEquals($exReference, $tag->getReference());
}
/**
@@ -65,28 +60,25 @@ class SeeTagTest extends \PHPUnit_Framework_TestCase
*/
public function provideDataForConstuctor()
{
// $type, $content, $exName, $exContent, $exDescription, $exReference
// $type, $content, $exContent, $exDescription, $exReference
return array(
array(
'uses',
'see',
'Foo::bar()',
'uses',
'Foo::bar()',
'',
'Foo::bar()'
),
array(
'uses',
'see',
'Foo::bar() Testing',
'uses',
'Foo::bar() Testing',
'Testing',
'Foo::bar()',
),
array(
'uses',
'see',
'Foo::bar() Testing comments',
'uses',
'Foo::bar() Testing comments',
'Testing comments',
'Foo::bar()',
@@ -40,22 +40,16 @@ class UsesTagTest extends \PHPUnit_Framework_TestCase
public function testConstructorParesInputsIntoCorrectFields(
$type,
$content,
$exName,
$exContent,
$exDescription,
$exReference
) {
$tag = new UsesTag($type, $content);
$actualName = $tag->getName();
$actualContent = $tag->getContent();
$actualDescription = $tag->getDescription();
$actualReference = $tag->getReference();
$this->assertEquals($exName, $actualName);
$this->assertEquals($exContent, $actualContent);
$this->assertEquals($exDescription, $actualDescription);
$this->assertEquals($exReference, $actualReference);
$this->assertEquals($type, $tag->getName());
$this->assertEquals($exContent, $tag->getContent());
$this->assertEquals($exDescription, $tag->getDescription());
$this->assertEquals($exReference, $tag->getReference());
}
/**
@@ -70,7 +64,6 @@ class UsesTagTest extends \PHPUnit_Framework_TestCase
array(
'uses',
'Foo::bar()',
'uses',
'Foo::bar()',
'',
'Foo::bar()'
@@ -78,7 +71,6 @@ class UsesTagTest extends \PHPUnit_Framework_TestCase
array(
'uses',
'Foo::bar() Testing',
'uses',
'Foo::bar() Testing',
'Testing',
'Foo::bar()',
@@ -86,7 +78,6 @@ class UsesTagTest extends \PHPUnit_Framework_TestCase
array(
'uses',
'Foo::bar() Testing comments',
'uses',
'Foo::bar() Testing comments',
'Testing comments',
'Foo::bar()',
@@ -46,6 +46,7 @@ class VarTagTest extends \PHPUnit_Framework_TestCase
) {
$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());
@@ -81,6 +82,13 @@ class VarTagTest extends \PHPUnit_Framework_TestCase
'$bob',
'Number of bobs'
),
array(
'var',
'',
'',
'',
''
),
);
}
}
@@ -49,6 +49,9 @@ DOCBLOCK;
$this->assertFalse($object->hasTag('category'));
}
/**
* @covers \phpDocumentor\Reflection\DocBlock::__construct
*/
public function testConstructFromReflector()
{
$object = new DocBlock(new \ReflectionClass($this));
@@ -70,7 +73,7 @@ DOCBLOCK;
*/
public function testExceptionOnInvalidObject()
{
$object = new DocBlock($this);
new DocBlock($this);
}
public function testDotSeperation()