From b2e816c8ad32c32257e3a3d83dc53f94548109b7 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:27:17 +0100 Subject: [PATCH] fix tests --- src/DocBlock/TagFactory.php | 2 +- tests/unit/DocBlockFactoryTest.php | 2 ++ tests/unit/DocBlockTest.php | 54 ------------------------------ 3 files changed, 3 insertions(+), 55 deletions(-) diff --git a/src/DocBlock/TagFactory.php b/src/DocBlock/TagFactory.php index 9f7a63a..1ed808f 100644 --- a/src/DocBlock/TagFactory.php +++ b/src/DocBlock/TagFactory.php @@ -67,7 +67,7 @@ interface TagFactory * * @return Tag A new tag object. */ - public function create(string $tagLine, TypeContext $context = null): Tag; + public function create(string $tagLine, TypeContext $context = null): ?Tag; /** * Registers a handler for tags. diff --git a/tests/unit/DocBlockFactoryTest.php b/tests/unit/DocBlockFactoryTest.php index 85be2a1..7822e55 100644 --- a/tests/unit/DocBlockFactoryTest.php +++ b/tests/unit/DocBlockFactoryTest.php @@ -263,6 +263,8 @@ DOCBLOCK $tagFactoryMock->shouldReceive('create')->with(m::any(), $context)->andReturn(new Param('param')); $docblock = $fixture->create('/** @param MyType $param */', $context); + + $this->assertInstanceOf(DocBlock::class, $docblock); } /** diff --git a/tests/unit/DocBlockTest.php b/tests/unit/DocBlockTest.php index 3ea7e23..0bf2a0f 100644 --- a/tests/unit/DocBlockTest.php +++ b/tests/unit/DocBlockTest.php @@ -48,36 +48,6 @@ class DocBlockTest extends 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 @@ -154,18 +124,6 @@ class DocBlockTest extends 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 @@ -191,18 +149,6 @@ class DocBlockTest extends 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