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
+13 -17
View File
@@ -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');
}
+2 -2
View File
@@ -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');
}
+2 -2
View File
@@ -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(''));
}
}
+4 -4
View File
@@ -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');
}
}
+16 -16
View File
@@ -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' ] ]);
}
+6 -6
View File
@@ -182,30 +182,30 @@ class ParamTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::<public>
* @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());
}
}
@@ -168,30 +168,30 @@ class PropertyReadTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::<public>
* @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());
}
}
+6 -6
View File
@@ -163,30 +163,30 @@ class PropertyTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::<public>
* @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());
}
}
@@ -168,30 +168,30 @@ class PropertyWriteTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::<public>
* @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());
}
}
+6 -6
View File
@@ -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());
}
}
+6 -6
View File
@@ -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());
}
}
+8 -8
View File
@@ -160,10 +160,10 @@ class SourceTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Source::<public>
* @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', []);
}
}
+6 -6
View File
@@ -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());
}
}
+6 -6
View File
@@ -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());
}
}
+6 -6
View File
@@ -174,30 +174,30 @@ class VarTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::<public>
* @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());
}
}
+2 -5
View File
@@ -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);
}