use PHPUnit 6.0 syntax for tests

This commit is contained in:
TomasVotruba
2017-11-30 10:27:01 +01:00
committed by Jaap van Otterdijk
parent 5282c2e9a8
commit e9e35284d9
16 changed files with 101 additions and 108 deletions
+6 -10
View File
@@ -146,11 +146,11 @@ class StandardTagFactoryTest extends TestCase
* @covers ::create * @covers ::create
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage The tag "@user[myuser" does not seem to be wellformed, please check it for errors
*/ */
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 = new StandardTagFactory(m::mock(FqsenResolver::class));
$tagFactory->create('@user[myuser'); $tagFactory->create('@user[myuser');
} }
@@ -235,13 +235,12 @@ class StandardTagFactoryTest extends TestCase
* @covers ::registerTagHandler * @covers ::registerTagHandler
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @expectedException \InvalidArgumentException
*/ */
public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified() : void public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified() : void
{ {
$this->expectException('InvalidArgumentException');
$resolver = m::mock(FqsenResolver::class); $resolver = m::mock(FqsenResolver::class);
$tagFactory = new StandardTagFactory($resolver); $tagFactory = new StandardTagFactory($resolver);
$tagFactory->registerTagHandler('Name\Spaced\Tag', Author::class); $tagFactory->registerTagHandler('Name\Spaced\Tag', Author::class);
} }
@@ -249,13 +248,12 @@ class StandardTagFactoryTest extends TestCase
* @covers ::registerTagHandler * @covers ::registerTagHandler
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @expectedException \InvalidArgumentException
*/ */
public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty() : void public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty() : void
{ {
$this->expectException('InvalidArgumentException');
$resolver = m::mock(FqsenResolver::class); $resolver = m::mock(FqsenResolver::class);
$tagFactory = new StandardTagFactory($resolver); $tagFactory = new StandardTagFactory($resolver);
$tagFactory->registerTagHandler('my-tag', ''); $tagFactory->registerTagHandler('my-tag', '');
} }
@@ -263,13 +261,12 @@ class StandardTagFactoryTest extends TestCase
* @covers ::registerTagHandler * @covers ::registerTagHandler
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @expectedException \InvalidArgumentException
*/ */
public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName() : void public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName() : void
{ {
$this->expectException('InvalidArgumentException');
$resolver = m::mock(FqsenResolver::class); $resolver = m::mock(FqsenResolver::class);
$tagFactory = new StandardTagFactory($resolver); $tagFactory = new StandardTagFactory($resolver);
$tagFactory->registerTagHandler('my-tag', 'IDoNotExist'); $tagFactory->registerTagHandler('my-tag', 'IDoNotExist');
} }
@@ -277,13 +274,12 @@ class StandardTagFactoryTest extends TestCase
* @covers ::registerTagHandler * @covers ::registerTagHandler
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @expectedException \InvalidArgumentException
*/ */
public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface() : void public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface() : void
{ {
$this->expectException('InvalidArgumentException');
$resolver = m::mock(FqsenResolver::class); $resolver = m::mock(FqsenResolver::class);
$tagFactory = new StandardTagFactory($resolver); $tagFactory = new StandardTagFactory($resolver);
$tagFactory->registerTagHandler('my-tag', 'stdClass'); $tagFactory->registerTagHandler('my-tag', 'stdClass');
} }
+1 -1
View File
@@ -97,10 +97,10 @@ class AuthorTest extends TestCase
/** /**
* @covers ::__construct * @covers ::__construct
* @expectedException \InvalidArgumentException
*/ */
public function testInitializationFailsIfEmailIsNotValid() : void public function testInitializationFailsIfEmailIsNotValid() : void
{ {
$this->expectException('InvalidArgumentException');
new Author('Mike van Riel', 'mike'); new Author('Mike van Riel', 'mike');
} }
+1 -1
View File
@@ -148,10 +148,10 @@ class CoversTest extends TestCase
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfBodyIsNotEmpty() : void public function testFactoryMethodFailsIfBodyIsNotEmpty() : void
{ {
$this->expectException('InvalidArgumentException');
$this->assertNull(Covers::create('')); $this->assertNull(Covers::create(''));
} }
} }
+2 -2
View File
@@ -127,20 +127,20 @@ class GenericTest extends TestCase
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfNameIsNotEmpty() : void public function testFactoryMethodFailsIfNameIsNotEmpty() : void
{ {
$this->expectException('InvalidArgumentException');
Generic::create('', ''); Generic::create('', '');
} }
/** /**
* @covers ::create * @covers ::create
* @covers ::__construct * @covers ::__construct
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfNameContainsIllegalCharacters() : void public function testFactoryMethodFailsIfNameContainsIllegalCharacters() : void
{ {
$this->expectException('InvalidArgumentException');
Generic::create('', 'name/myname'); Generic::create('', 'name/myname');
} }
} }
+8 -8
View File
@@ -366,73 +366,73 @@ class MethodTest extends TestCase
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfBodyIsEmpty() : void public function testFactoryMethodFailsIfBodyIsEmpty() : void
{ {
$this->expectException('InvalidArgumentException');
Method::create(''); Method::create('');
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodReturnsNullIfBodyIsIncorrect() : void public function testFactoryMethodReturnsNullIfBodyIsIncorrect() : void
{ {
$this->expectException('InvalidArgumentException');
$this->assertNull(Method::create('body(')); $this->assertNull(Method::create('body('));
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfResolverIsNull() : void public function testFactoryMethodFailsIfResolverIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Method::create('body'); Method::create('body');
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Method::create('body', new TypeResolver()); Method::create('body', new TypeResolver());
} }
/** /**
* @covers ::__construct * @covers ::__construct
* @expectedException \InvalidArgumentException
*/ */
public function testCreationFailsIfBodyIsNotString() : void public function testCreationFailsIfBodyIsNotString() : void
{ {
$this->expectException('InvalidArgumentException');
new Method([]); new Method([]);
} }
/** /**
* @covers ::__construct * @covers ::__construct
* @expectedException \InvalidArgumentException
*/ */
public function testCreationFailsIfBodyIsEmpty() : void public function testCreationFailsIfBodyIsEmpty() : void
{ {
$this->expectException('InvalidArgumentException');
new Method(''); new Method('');
} }
/** /**
* @covers ::__construct * @covers ::__construct
* @expectedException \InvalidArgumentException
*/ */
public function testCreationFailsIfStaticIsNotBoolean() : void public function testCreationFailsIfStaticIsNotBoolean() : void
{ {
$this->expectException('InvalidArgumentException');
new Method('body', [], null, []); new Method('body', [], null, []);
} }
/** /**
* @covers ::__construct * @covers ::__construct
* @expectedException \InvalidArgumentException
*/ */
public function testCreationFailsIfArgumentRecordContainsInvalidEntry() : void public function testCreationFailsIfArgumentRecordContainsInvalidEntry() : void
{ {
$this->expectException('InvalidArgumentException');
new Method('body', [ [ 'name' => 'myName', 'unknown' => 'nah' ] ]); new Method('body', [ [ 'name' => 'myName', 'unknown' => 'nah' ] ]);
} }
+3 -3
View File
@@ -182,30 +182,30 @@ class ParamTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::<public> * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::<public>
* @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
{ {
$this->expectException('InvalidArgumentException');
$descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory = m::mock(DescriptionFactory::class);
Param::create('', new TypeResolver(), $descriptionFactory); Param::create('', new TypeResolver(), $descriptionFactory);
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfResolverIsNull() : void public function testFactoryMethodFailsIfResolverIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Param::create('body'); Param::create('body');
} }
/** /**
* @covers ::create * @covers ::create
* @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\TypeResolver
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Param::create('body', new TypeResolver()); Param::create('body', new TypeResolver());
} }
} }
@@ -168,30 +168,30 @@ class PropertyReadTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::<public> * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::<public>
* @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
{ {
$this->expectException('InvalidArgumentException');
$descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory = m::mock(DescriptionFactory::class);
PropertyRead::create('', new TypeResolver(), $descriptionFactory); PropertyRead::create('', new TypeResolver(), $descriptionFactory);
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfResolverIsNull() : void public function testFactoryMethodFailsIfResolverIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
PropertyRead::create('body'); PropertyRead::create('body');
} }
/** /**
* @covers ::create * @covers ::create
* @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\TypeResolver
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
PropertyRead::create('body', new TypeResolver()); PropertyRead::create('body', new TypeResolver());
} }
} }
+3 -3
View File
@@ -163,30 +163,30 @@ class PropertyTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::<public> * @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::<public>
* @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
{ {
$this->expectException('InvalidArgumentException');
$descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory = m::mock(DescriptionFactory::class);
Property::create('', new TypeResolver(), $descriptionFactory); Property::create('', new TypeResolver(), $descriptionFactory);
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfResolverIsNull() : void public function testFactoryMethodFailsIfResolverIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Property::create('body'); Property::create('body');
} }
/** /**
* @covers ::create * @covers ::create
* @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\TypeResolver
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Property::create('body', new TypeResolver()); Property::create('body', new TypeResolver());
} }
} }
@@ -168,30 +168,30 @@ class PropertyWriteTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::<public> * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::<public>
* @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
{ {
$this->expectException('InvalidArgumentException');
$descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory = m::mock(DescriptionFactory::class);
PropertyWrite::create('', new TypeResolver(), $descriptionFactory); PropertyWrite::create('', new TypeResolver(), $descriptionFactory);
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfResolverIsNull() : void public function testFactoryMethodFailsIfResolverIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
PropertyWrite::create('body'); PropertyWrite::create('body');
} }
/** /**
* @covers ::create * @covers ::create
* @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\TypeResolver
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
PropertyWrite::create('body', new TypeResolver()); PropertyWrite::create('body', new TypeResolver());
} }
} }
+3 -3
View File
@@ -144,28 +144,28 @@ class ReturnTest extends TestCase
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfBodyIsNotEmpty() : void public function testFactoryMethodFailsIfBodyIsNotEmpty() : void
{ {
$this->expectException('InvalidArgumentException');
$this->assertNull(Return_::create('')); $this->assertNull(Return_::create(''));
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfResolverIsNull() : void public function testFactoryMethodFailsIfResolverIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Return_::create('body'); Return_::create('body');
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Return_::create('body', new TypeResolver()); Return_::create('body', new TypeResolver());
} }
} }
+3 -3
View File
@@ -192,28 +192,28 @@ class SeeTest extends TestCase
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfBodyIsNotEmpty() : void public function testFactoryMethodFailsIfBodyIsNotEmpty() : void
{ {
$this->expectException('InvalidArgumentException');
$this->assertNull(See::create('')); $this->assertNull(See::create(''));
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfResolverIsNull() : void public function testFactoryMethodFailsIfResolverIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
See::create('body'); See::create('body');
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
See::create('body', new FqsenResolver()); See::create('body', new FqsenResolver());
} }
} }
+4 -4
View File
@@ -160,10 +160,10 @@ class SourceTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Source::<public> * @uses \phpDocumentor\Reflection\DocBlock\Tags\Source::<public>
* @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
{ {
$this->expectException('InvalidArgumentException');
$descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory = m::mock(DescriptionFactory::class);
Source::create('', $descriptionFactory); Source::create('', $descriptionFactory);
} }
@@ -171,28 +171,28 @@ class SourceTest extends TestCase
/** /**
* @covers ::create * @covers ::create
* @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\TypeResolver
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Source::create('1'); Source::create('1');
} }
/** /**
* @covers ::__construct * @covers ::__construct
* @expectedException \InvalidArgumentException
*/ */
public function testExceptionIsThrownIfStartingLineIsNotInteger() : void public function testExceptionIsThrownIfStartingLineIsNotInteger() : void
{ {
$this->expectException('InvalidArgumentException');
new Source('blabla'); new Source('blabla');
} }
/** /**
* @covers ::__construct * @covers ::__construct
* @expectedException \InvalidArgumentException
*/ */
public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull() : void public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull() : void
{ {
$this->expectException('InvalidArgumentException');
new Source('1', []); new Source('1', []);
} }
} }
+3 -3
View File
@@ -144,28 +144,28 @@ class ThrowsTest extends TestCase
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfBodyIsNotEmpty() : void public function testFactoryMethodFailsIfBodyIsNotEmpty() : void
{ {
$this->expectException('InvalidArgumentException');
$this->assertNull(Throws::create('')); $this->assertNull(Throws::create(''));
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfResolverIsNull() : void public function testFactoryMethodFailsIfResolverIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Throws::create('body'); Throws::create('body');
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Throws::create('body', new TypeResolver()); Throws::create('body', new TypeResolver());
} }
} }
+3 -3
View File
@@ -147,28 +147,28 @@ class UsesTest extends TestCase
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfBodyIsNotEmpty() : void public function testFactoryMethodFailsIfBodyIsNotEmpty() : void
{ {
$this->expectException('InvalidArgumentException');
$this->assertNull(Uses::create('')); $this->assertNull(Uses::create(''));
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfResolverIsNull() : void public function testFactoryMethodFailsIfResolverIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Uses::create('body'); Uses::create('body');
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Uses::create('body', new FqsenResolver()); Uses::create('body', new FqsenResolver());
} }
} }
+3 -3
View File
@@ -174,30 +174,30 @@ class VarTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::<public> * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::<public>
* @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
{ {
$this->expectException('InvalidArgumentException');
$descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory = m::mock(DescriptionFactory::class);
Var_::create('', new TypeResolver(), $descriptionFactory); Var_::create('', new TypeResolver(), $descriptionFactory);
} }
/** /**
* @covers ::create * @covers ::create
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfResolverIsNull() : void public function testFactoryMethodFailsIfResolverIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Var_::create('body'); Var_::create('body');
} }
/** /**
* @covers ::create * @covers ::create
* @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\TypeResolver
* @expectedException \InvalidArgumentException
*/ */
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{ {
$this->expectException('InvalidArgumentException');
Var_::create('body', new TypeResolver()); Var_::create('body', new TypeResolver());
} }
} }
+1 -4
View File
@@ -84,18 +84,15 @@ class DocBlockTest extends TestCase
/** /**
* @covers ::__construct * @covers ::__construct
* @covers ::getTags * @covers ::getTags
*
* @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tag * @uses \phpDocumentor\Reflection\DocBlock\Tag
*
* @expectedException \InvalidArgumentException
*/ */
public function testDocBlockAllowsOnlyTags() : void public function testDocBlockAllowsOnlyTags() : void
{ {
$this->expectException('InvalidArgumentException');
$tags = [ $tags = [
null null
]; ];
$fixture = new DocBlock('', null, $tags); $fixture = new DocBlock('', null, $tags);
} }