Add assertions to DocBlock

This commit is contained in:
Mike van Riel
2015-06-13 18:41:45 +02:00
committed by Mike van Riel
parent 57c78b2c8b
commit ab3ebf467c
2 changed files with 64 additions and 0 deletions
+55
View File
@@ -18,6 +18,7 @@ use phpDocumentor\Reflection\Types\Context;
/**
* @coversDefaultClass phpDocumentor\Reflection\DocBlock
* @covers ::<private>
* @uses \Webmozart\Assert\Assert
*/
class DocBlockTest extends \PHPUnit_Framework_TestCase
{
@@ -36,6 +37,36 @@ class DocBlockTest extends \PHPUnit_Framework_TestCase
$this->assertSame($summary, $fixture->getSummary());
}
/**
* @covers ::__construct
*
* @expectedException \InvalidArgumentException
*/
public function testExceptionIsThrownIfSummaryIsNotAString()
{
new DocBlock([]);
}
/**
* @covers ::__construct
*
* @expectedException \InvalidArgumentException
*/
public function testExceptionIsThrownIfTemplateStartIsNotABoolean()
{
new DocBlock('', null, [], null, null, ['is not boolean']);
}
/**
* @covers ::__construct
*
* @expectedException \InvalidArgumentException
*/
public function testExceptionIsThrownIfTemplateEndIsNotABoolean()
{
new DocBlock('', null, [], null, null, false, ['is not boolean']);
}
/**
* @covers ::__construct
* @covers ::getDescription
@@ -94,6 +125,18 @@ class DocBlockTest extends \PHPUnit_Framework_TestCase
$this->assertSame([], $fixture->getTagsByName('Ebcd'));
}
/**
* @covers ::__construct
* @covers ::getTagsByName
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @expectedException \InvalidArgumentException
*/
public function testExceptionIsThrownIfNameForTagsIsNotString()
{
$fixture = new DocBlock();
$fixture->getTagsByName([]);
}
/**
* @covers ::__construct
* @covers ::hasTag
@@ -119,6 +162,18 @@ class DocBlockTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($fixture->hasTag('Ebcd'));
}
/**
* @covers ::__construct
* @covers ::hasTag
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @expectedException \InvalidArgumentException
*/
public function testExceptionIsThrownIfNameForCheckingTagsIsNotString()
{
$fixture = new DocBlock();
$fixture->hasTag([]);
}
/**
* @covers ::__construct
* @covers ::getContext