From e9e35284d9c11fdddd2affadeea20401a55a563a Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:44:57 +0100 Subject: [PATCH] use PHPUnit 6.0 syntax for tests --- .../unit/DocBlock/StandardTagFactoryTest.php | 30 ++++++++--------- tests/unit/DocBlock/Tags/AuthorTest.php | 4 +-- tests/unit/DocBlock/Tags/CoversTest.php | 4 +-- tests/unit/DocBlock/Tags/GenericTest.php | 8 ++--- tests/unit/DocBlock/Tags/MethodTest.php | 32 +++++++++---------- tests/unit/DocBlock/Tags/ParamTest.php | 12 +++---- tests/unit/DocBlock/Tags/PropertyReadTest.php | 12 +++---- tests/unit/DocBlock/Tags/PropertyTest.php | 12 +++---- .../unit/DocBlock/Tags/PropertyWriteTest.php | 12 +++---- tests/unit/DocBlock/Tags/ReturnTest.php | 12 +++---- tests/unit/DocBlock/Tags/SeeTest.php | 12 +++---- tests/unit/DocBlock/Tags/SourceTest.php | 16 +++++----- tests/unit/DocBlock/Tags/ThrowsTest.php | 12 +++---- tests/unit/DocBlock/Tags/UsesTest.php | 12 +++---- tests/unit/DocBlock/Tags/VarTest.php | 12 +++---- tests/unit/DocBlockTest.php | 7 ++-- 16 files changed, 101 insertions(+), 108 deletions(-) diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index f360a2a..8a03f7a 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -144,13 +144,13 @@ class StandardTagFactoryTest extends TestCase /** * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The tag "@user[myuser" does not seem to be wellformed, please check it for errors + * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct + * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testExceptionIsThrownIfProvidedTagIsNotWellformed(): void + public function testExceptionIsThrownIfProvidedTagIsNotWellformed() : void { + $this->expectException('InvalidArgumentException'); + $this->expectExceptionMessage('The tag "@user[myuser" does not seem to be wellformed, please check it for errors'); $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); $tagFactory->create('@user[myuser'); } @@ -235,13 +235,12 @@ class StandardTagFactoryTest extends TestCase * @covers ::registerTagHandler * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException */ - public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified(): void + public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified() : void { + $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); - $tagFactory->registerTagHandler('Name\Spaced\Tag', Author::class); } @@ -249,13 +248,12 @@ class StandardTagFactoryTest extends TestCase * @covers ::registerTagHandler * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty(): void + public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty() : void { + $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); - $tagFactory->registerTagHandler('my-tag', ''); } @@ -263,13 +261,12 @@ class StandardTagFactoryTest extends TestCase * @covers ::registerTagHandler * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName(): void + public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName() : void { + $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); - $tagFactory->registerTagHandler('my-tag', 'IDoNotExist'); } @@ -277,13 +274,12 @@ class StandardTagFactoryTest extends TestCase * @covers ::registerTagHandler * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException */ - public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface(): void + public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface() : void { + $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); - $tagFactory->registerTagHandler('my-tag', 'stdClass'); } diff --git a/tests/unit/DocBlock/Tags/AuthorTest.php b/tests/unit/DocBlock/Tags/AuthorTest.php index 183236b..7cdf56c 100644 --- a/tests/unit/DocBlock/Tags/AuthorTest.php +++ b/tests/unit/DocBlock/Tags/AuthorTest.php @@ -97,10 +97,10 @@ class AuthorTest extends TestCase /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testInitializationFailsIfEmailIsNotValid(): void + public function testInitializationFailsIfEmailIsNotValid() : void { + $this->expectException('InvalidArgumentException'); new Author('Mike van Riel', 'mike'); } diff --git a/tests/unit/DocBlock/Tags/CoversTest.php b/tests/unit/DocBlock/Tags/CoversTest.php index 87126b4..a462915 100644 --- a/tests/unit/DocBlock/Tags/CoversTest.php +++ b/tests/unit/DocBlock/Tags/CoversTest.php @@ -148,10 +148,10 @@ class CoversTest extends TestCase /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { + $this->expectException('InvalidArgumentException'); $this->assertNull(Covers::create('')); } } diff --git a/tests/unit/DocBlock/Tags/GenericTest.php b/tests/unit/DocBlock/Tags/GenericTest.php index 7c7d986..e8612de 100644 --- a/tests/unit/DocBlock/Tags/GenericTest.php +++ b/tests/unit/DocBlock/Tags/GenericTest.php @@ -127,20 +127,20 @@ class GenericTest extends TestCase /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfNameIsNotEmpty(): void + public function testFactoryMethodFailsIfNameIsNotEmpty() : void { + $this->expectException('InvalidArgumentException'); Generic::create('', ''); } /** * @covers ::create * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfNameContainsIllegalCharacters(): void + public function testFactoryMethodFailsIfNameContainsIllegalCharacters() : void { + $this->expectException('InvalidArgumentException'); Generic::create('', 'name/myname'); } } diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index 4f811d0..379a263 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -366,73 +366,73 @@ class MethodTest extends TestCase /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsEmpty(): void + public function testFactoryMethodFailsIfBodyIsEmpty() : void { + $this->expectException('InvalidArgumentException'); Method::create(''); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodReturnsNullIfBodyIsIncorrect(): void + public function testFactoryMethodReturnsNullIfBodyIsIncorrect() : void { + $this->expectException('InvalidArgumentException'); $this->assertNull(Method::create('body(')); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Method::create('body'); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Method::create('body', new TypeResolver()); } /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfBodyIsNotString(): void + public function testCreationFailsIfBodyIsNotString() : void { + $this->expectException('InvalidArgumentException'); new Method([]); } /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfBodyIsEmpty(): void + public function testCreationFailsIfBodyIsEmpty() : void { + $this->expectException('InvalidArgumentException'); new Method(''); } /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfStaticIsNotBoolean(): void + public function testCreationFailsIfStaticIsNotBoolean() : void { + $this->expectException('InvalidArgumentException'); new Method('body', [], null, []); } /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void + public function testCreationFailsIfArgumentRecordContainsInvalidEntry() : void { + $this->expectException('InvalidArgumentException'); new Method('body', [ [ 'name' => 'myName', 'unknown' => 'nah' ] ]); } diff --git a/tests/unit/DocBlock/Tags/ParamTest.php b/tests/unit/DocBlock/Tags/ParamTest.php index 1f0edf2..eaa7dcd 100644 --- a/tests/unit/DocBlock/Tags/ParamTest.php +++ b/tests/unit/DocBlock/Tags/ParamTest.php @@ -182,30 +182,30 @@ class ParamTest extends TestCase * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { + $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); Param::create('', new TypeResolver(), $descriptionFactory); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Param::create('body'); } /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Param::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlock/Tags/PropertyReadTest.php b/tests/unit/DocBlock/Tags/PropertyReadTest.php index 5bf0723..78132af 100644 --- a/tests/unit/DocBlock/Tags/PropertyReadTest.php +++ b/tests/unit/DocBlock/Tags/PropertyReadTest.php @@ -168,30 +168,30 @@ class PropertyReadTest extends TestCase * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { + $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); PropertyRead::create('', new TypeResolver(), $descriptionFactory); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); PropertyRead::create('body'); } /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); PropertyRead::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlock/Tags/PropertyTest.php b/tests/unit/DocBlock/Tags/PropertyTest.php index 73af398..9d4cdfa 100644 --- a/tests/unit/DocBlock/Tags/PropertyTest.php +++ b/tests/unit/DocBlock/Tags/PropertyTest.php @@ -163,30 +163,30 @@ class PropertyTest extends TestCase * @uses \phpDocumentor\Reflection\DocBlock\Tags\Property:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { + $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); Property::create('', new TypeResolver(), $descriptionFactory); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Property::create('body'); } /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Property::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlock/Tags/PropertyWriteTest.php b/tests/unit/DocBlock/Tags/PropertyWriteTest.php index 185dff0..cdc146b 100644 --- a/tests/unit/DocBlock/Tags/PropertyWriteTest.php +++ b/tests/unit/DocBlock/Tags/PropertyWriteTest.php @@ -168,30 +168,30 @@ class PropertyWriteTest extends TestCase * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { + $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); PropertyWrite::create('', new TypeResolver(), $descriptionFactory); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); PropertyWrite::create('body'); } /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); PropertyWrite::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlock/Tags/ReturnTest.php b/tests/unit/DocBlock/Tags/ReturnTest.php index 76071ec..61ab6a2 100644 --- a/tests/unit/DocBlock/Tags/ReturnTest.php +++ b/tests/unit/DocBlock/Tags/ReturnTest.php @@ -144,28 +144,28 @@ class ReturnTest extends TestCase /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { + $this->expectException('InvalidArgumentException'); $this->assertNull(Return_::create('')); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Return_::create('body'); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Return_::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlock/Tags/SeeTest.php b/tests/unit/DocBlock/Tags/SeeTest.php index 598f764..b969bba 100644 --- a/tests/unit/DocBlock/Tags/SeeTest.php +++ b/tests/unit/DocBlock/Tags/SeeTest.php @@ -192,28 +192,28 @@ class SeeTest extends TestCase /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { + $this->expectException('InvalidArgumentException'); $this->assertNull(See::create('')); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); See::create('body'); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); See::create('body', new FqsenResolver()); } } diff --git a/tests/unit/DocBlock/Tags/SourceTest.php b/tests/unit/DocBlock/Tags/SourceTest.php index f2ab955..950cc30 100644 --- a/tests/unit/DocBlock/Tags/SourceTest.php +++ b/tests/unit/DocBlock/Tags/SourceTest.php @@ -160,10 +160,10 @@ class SourceTest extends TestCase * @uses \phpDocumentor\Reflection\DocBlock\Tags\Source:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { + $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); Source::create('', $descriptionFactory); } @@ -171,28 +171,28 @@ class SourceTest extends TestCase /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Source::create('1'); } /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testExceptionIsThrownIfStartingLineIsNotInteger(): void + public function testExceptionIsThrownIfStartingLineIsNotInteger() : void { + $this->expectException('InvalidArgumentException'); new Source('blabla'); } /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull(): void + public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull() : void { + $this->expectException('InvalidArgumentException'); new Source('1', []); } } diff --git a/tests/unit/DocBlock/Tags/ThrowsTest.php b/tests/unit/DocBlock/Tags/ThrowsTest.php index 3b42dca..07ba54d 100644 --- a/tests/unit/DocBlock/Tags/ThrowsTest.php +++ b/tests/unit/DocBlock/Tags/ThrowsTest.php @@ -144,28 +144,28 @@ class ThrowsTest extends TestCase /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { + $this->expectException('InvalidArgumentException'); $this->assertNull(Throws::create('')); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Throws::create('body'); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Throws::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlock/Tags/UsesTest.php b/tests/unit/DocBlock/Tags/UsesTest.php index e581232..4dc6910 100644 --- a/tests/unit/DocBlock/Tags/UsesTest.php +++ b/tests/unit/DocBlock/Tags/UsesTest.php @@ -147,28 +147,28 @@ class UsesTest extends TestCase /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { + $this->expectException('InvalidArgumentException'); $this->assertNull(Uses::create('')); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Uses::create('body'); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Uses::create('body', new FqsenResolver()); } } diff --git a/tests/unit/DocBlock/Tags/VarTest.php b/tests/unit/DocBlock/Tags/VarTest.php index 070fc7b..7ade39e 100644 --- a/tests/unit/DocBlock/Tags/VarTest.php +++ b/tests/unit/DocBlock/Tags/VarTest.php @@ -174,30 +174,30 @@ class VarTest extends TestCase * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { + $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); Var_::create('', new TypeResolver(), $descriptionFactory); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Var_::create('body'); } /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Var_::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlockTest.php b/tests/unit/DocBlockTest.php index 84580d7..7961fec 100644 --- a/tests/unit/DocBlockTest.php +++ b/tests/unit/DocBlockTest.php @@ -84,18 +84,15 @@ class DocBlockTest extends TestCase /** * @covers ::__construct * @covers ::getTags - * * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tag - * - * @expectedException \InvalidArgumentException */ - public function testDocBlockAllowsOnlyTags(): void + public function testDocBlockAllowsOnlyTags() : void { + $this->expectException('InvalidArgumentException'); $tags = [ null ]; - $fixture = new DocBlock('', null, $tags); }