Apply new code style

This commit is contained in:
Jaapio
2019-09-20 10:54:12 +02:00
parent 8fcadfe5f8
commit aee984014b
71 changed files with 1661 additions and 1286 deletions
+45 -37
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,15 +8,13 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\DocBlock;
use Mockery as m;
use phpDocumentor\Reflection\DocBlock\Tags\Link;
use phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag;
use phpDocumentor\Reflection\Types\Context;
use PHPUnit\Framework\TestCase;
@@ -27,103 +27,108 @@ class DescriptionFactoryTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers ::create
* @uses phpDocumentor\Reflection\DocBlock\Description
* @dataProvider provideSimpleExampleDescriptions
*/
public function testDescriptionCanParseASimpleString($contents): void
public function testDescriptionCanParseASimpleString(string $contents) : void
{
$tagFactory = m::mock(TagFactory::class);
$tagFactory->shouldReceive('create')->never();
$factory = new DescriptionFactory($tagFactory);
$factory = new DescriptionFactory($tagFactory);
$description = $factory->create($contents, new Context(''));
$this->assertSame($contents, $description->render());
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers ::create
* @uses phpDocumentor\Reflection\DocBlock\Description
* @dataProvider provideEscapeSequences
*/
public function testEscapeSequences($contents, $expected): void
public function testEscapeSequences(string $contents, string $expected) : void
{
$tagFactory = m::mock(TagFactory::class);
$tagFactory->shouldReceive('create')->never();
$factory = new DescriptionFactory($tagFactory);
$factory = new DescriptionFactory($tagFactory);
$description = $factory->create($contents, new Context(''));
$this->assertSame($expected, $description->render());
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Link
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::__construct
* @covers ::create
* @uses phpDocumentor\Reflection\DocBlock\Description
* @uses phpDocumentor\Reflection\DocBlock\Tags\Link
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses phpDocumentor\Reflection\Types\Context
*/
public function testDescriptionCanParseAStringWithInlineTag(): void
public function testDescriptionCanParseAStringWithInlineTag() : void
{
$contents = 'This is text for a {@link http://phpdoc.org/ description} that uses an inline tag.';
$context = new Context('');
$contents = 'This is text for a {@link http://phpdoc.org/ description} that uses an inline tag.';
$context = new Context('');
$tagFactory = m::mock(TagFactory::class);
$tagFactory->shouldReceive('create')
->once()
->with('@link http://phpdoc.org/ description', $context)
->andReturn(new Link('http://phpdoc.org/', new Description('description')));
->andReturn(new LinkTag('http://phpdoc.org/', new Description('description')));
$factory = new DescriptionFactory($tagFactory);
$factory = new DescriptionFactory($tagFactory);
$description = $factory->create($contents, $context);
$this->assertSame($contents, $description->render());
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Link
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::__construct
* @covers ::create
* @uses phpDocumentor\Reflection\DocBlock\Description
* @uses phpDocumentor\Reflection\DocBlock\Tags\Link
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses phpDocumentor\Reflection\Types\Context
*/
public function testDescriptionCanParseAStringStartingWithInlineTag(): void
public function testDescriptionCanParseAStringStartingWithInlineTag() : void
{
$contents = '{@link http://phpdoc.org/ This} is text for a description that starts with an inline tag.';
$context = new Context('');
$contents = '{@link http://phpdoc.org/ This} is text for a description that starts with an inline tag.';
$context = new Context('');
$tagFactory = m::mock(TagFactory::class);
$tagFactory->shouldReceive('create')
->once()
->with('@link http://phpdoc.org/ This', $context)
->andReturn(new Link('http://phpdoc.org/', new Description('This')));
->andReturn(new LinkTag('http://phpdoc.org/', new Description('This')));
$factory = new DescriptionFactory($tagFactory);
$factory = new DescriptionFactory($tagFactory);
$description = $factory->create($contents, $context);
$this->assertSame($contents, $description->render());
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers ::create
* @uses phpDocumentor\Reflection\DocBlock\Description
*/
public function testIfSuperfluousStartingSpacesAreRemoved(): void
public function testIfSuperfluousStartingSpacesAreRemoved() : void
{
$factory = new DescriptionFactory(m::mock(TagFactory::class));
$factory = new DescriptionFactory(m::mock(TagFactory::class));
$descriptionText = <<<DESCRIPTION
This is a multiline
description that you commonly
@@ -162,7 +167,7 @@ DESCRIPTION;
*
* @return string[][]
*/
public function provideSimpleExampleDescriptions()
public function provideSimpleExampleDescriptions() : array
{
return [
['This is text for a description.'],
@@ -172,7 +177,10 @@ DESCRIPTION;
];
}
public function provideEscapeSequences()
/**
* @return string[][]
*/
public function provideEscapeSequences() : array
{
return [
['This is text for a description with a {@}.', 'This is text for a description with a @.'],
+28 -23
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -26,23 +26,24 @@ class DescriptionTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
/**
* @covers ::__construct
* @covers ::render
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
*
* @covers ::__construct
* @covers ::render
*/
public function testDescriptionCanRenderUsingABodyWithPlaceholdersAndTags(): void
public function testDescriptionCanRenderUsingABodyWithPlaceholdersAndTags() : void
{
$body = 'This is a %1$s body.';
$body = 'This is a %1$s body.';
$expected = 'This is a {@internal significant} body.';
$tags = [new Generic('internal', new Description('significant '))];
$tags = [new Generic('internal', new Description('significant '))];
$fixture = new Description($body, $tags);
@@ -56,18 +57,19 @@ class DescriptionTest extends TestCase
}
/**
* @covers ::__construct
* @covers ::render
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
*
* @covers ::__construct
* @covers ::render
* @covers ::__toString
*/
public function testDescriptionCanBeCastToString(): void
public function testDescriptionCanBeCastToString() : void
{
$body = 'This is a %1$s body.';
$body = 'This is a %1$s body.';
$expected = 'This is a {@internal significant} body.';
$tags = [new Generic('internal', new Description('significant '))];
$tags = [new Generic('internal', new Description('significant '))];
$fixture = new Description($body, $tags);
@@ -75,11 +77,12 @@ class DescriptionTest extends TestCase
}
/**
* @covers ::getTags
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*
* @covers ::getTags
*/
public function testDescriptionTagsGetter(): void
public function testDescriptionTagsGetter() : void
{
$body = '@JoinTable(name="table", joinColumns=%1$s, inverseJoinColumns=%2$s)';
@@ -102,14 +105,15 @@ class DescriptionTest extends TestCase
}
/**
* @covers ::__construct
* @covers ::render
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
*
* @covers ::__construct
* @covers ::render
* @covers ::__toString
*/
public function testDescriptionMultipleTagsCanBeCastToString(): void
public function testDescriptionMultipleTagsCanBeCastToString() : void
{
$body = '@JoinTable(name="table", joinColumns=%1$s, inverseJoinColumns=%2$s)';
@@ -121,8 +125,9 @@ class DescriptionTest extends TestCase
$tag2,
];
$fixture = new Description($body, $tags);
$expected = '@JoinTable(name="table", joinColumns={@JoinColumn (name="column_id", referencedColumnName="id")}, inverseJoinColumns={@JoinColumn (name="column_id_2", referencedColumnName="id")})';
$fixture = new Description($body, $tags);
$expected = '@JoinTable(name="table", joinColumns={@JoinColumn (name="column_id", referencedColumnName="id")}, '
. 'inverseJoinColumns={@JoinColumn (name="column_id_2", referencedColumnName="id")})';
$this->assertSame($expected, (string) $fixture);
}
}
+10 -7
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
namespace phpDocumentor\Reflection\DocBlock;
@@ -7,7 +9,7 @@ use phpDocumentor\Reflection\DocBlock\Tags\Example;
use PHPUnit\Framework\TestCase;
/**
* @coversDefaultClass phpDocumentor\Reflection\DocBlock\ExampleFinder
* @coversDefaultClass \phpDocumentor\Reflection\DocBlock\ExampleFinder
* @covers ::<private>
*/
class ExampleFinderTest extends TestCase
@@ -18,23 +20,24 @@ class ExampleFinderTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
public function setUp(): void
public function setUp() : void
{
$this->fixture = new ExampleFinder();
}
/**
* @covers ::find
* @covers ::getSourceDirectory
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Example
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::find
* @covers ::getSourceDirectory
*/
public function testFileNotFound(): void
public function testFileNotFound() : void
{
$example = new Example('./example.php', false, 1, 0, new Description('Test'));
$this->assertSame('** File not found : ./example.php **', $this->fixture->find($example));
+34 -30
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -26,21 +26,22 @@ class SerializerTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
*
* @covers ::__construct
* @covers ::getDocComment
* @uses phpDocumentor\Reflection\DocBlock\Description
* @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses phpDocumentor\Reflection\DocBlock
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses phpDocumentor\Reflection\DocBlock\Tags\Generic
*/
public function testReconstructsADocCommentFromADocBlock(): void
public function testReconstructsADocCommentFromADocBlock() : void
{
$expected = <<<'DOCCOMMENT'
/**
@@ -66,15 +67,16 @@ DOCCOMMENT;
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
*
* @covers ::__construct
* @covers ::getDocComment
* @uses phpDocumentor\Reflection\DocBlock\Description
* @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses phpDocumentor\Reflection\DocBlock
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses phpDocumentor\Reflection\DocBlock\Tags\Generic
*/
public function testAddPrefixToDocBlock(): void
public function testAddPrefixToDocBlock() : void
{
$expected = <<<'DOCCOMMENT'
aa/**
@@ -100,15 +102,16 @@ DOCCOMMENT;
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
*
* @covers ::__construct
* @covers ::getDocComment
* @uses phpDocumentor\Reflection\DocBlock\Description
* @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses phpDocumentor\Reflection\DocBlock
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses phpDocumentor\Reflection\DocBlock\Tags\Generic
*/
public function testAddPrefixToDocBlockExceptFirstLine(): void
public function testAddPrefixToDocBlockExceptFirstLine() : void
{
$expected = <<<'DOCCOMMENT'
/**
@@ -134,15 +137,16 @@ DOCCOMMENT;
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
*
* @covers ::__construct
* @covers ::getDocComment
* @uses phpDocumentor\Reflection\DocBlock\Description
* @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses phpDocumentor\Reflection\DocBlock
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses phpDocumentor\Reflection\DocBlock\Tags\Generic
*/
public function testWordwrapsAroundTheGivenAmountOfCharacters(): void
public function testWordwrapsAroundTheGivenAmountOfCharacters() : void
{
$expected = <<<'DOCCOMMENT'
/**
@@ -177,7 +181,7 @@ DOCCOMMENT;
* @covers ::__construct
* @covers ::getDocComment
*/
public function testNoExtraSpacesAfterTagRemoval()
public function testNoExtraSpacesAfterTagRemoval() : void
{
$expected = <<<'DOCCOMMENT'
/**
@@ -190,7 +194,7 @@ DOCCOMMENT;
*/
DOCCOMMENT_AFTER_REMOVE;
$fixture = new Serializer(0, '', true, 15);
$fixture = new Serializer(0, '', true, 15);
$genericTag = new DocBlock\Tags\Generic('unknown-tag');
$docBlock = new DocBlock('', null, [$genericTag]);
+88 -71
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,9 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\DocBlock;
@@ -27,7 +27,7 @@ use phpDocumentor\Reflection\Types\Context;
use PHPUnit\Framework\TestCase;
/**
* @coversDefaultClass phpDocumentor\Reflection\DocBlock\StandardTagFactory
* @coversDefaultClass \phpDocumentor\Reflection\DocBlock\StandardTagFactory
* @covers ::<private>
*/
class StandardTagFactoryTest extends TestCase
@@ -35,25 +35,26 @@ class StandardTagFactoryTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers ::create
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @uses phpDocumentor\Reflection\DocBlock\Tags\Generic
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses phpDocumentor\Reflection\DocBlock\Description
*/
public function testCreatingAGenericTag(): void
public function testCreatingAGenericTag() : void
{
$expectedTagName = 'unknown-tag';
$expectedTagName = 'unknown-tag';
$expectedDescriptionText = 'This is a description';
$expectedDescription = new Description($expectedDescriptionText);
$context = new Context('');
$expectedDescription = new Description($expectedDescriptionText);
$context = new Context('');
$descriptionFactory = m::mock(DescriptionFactory::class);
$descriptionFactory
@@ -74,15 +75,16 @@ class StandardTagFactoryTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Author
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*
* @covers ::__construct
* @covers ::create
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @uses phpDocumentor\Reflection\DocBlock\Tags\Author
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*/
public function testCreatingASpecificTag(): void
public function testCreatingASpecificTag() : void
{
$context = new Context('');
$context = new Context('');
$tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class));
/** @var Author $tag */
@@ -93,18 +95,19 @@ class StandardTagFactoryTest extends TestCase
}
/**
* @covers ::__construct
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @uses \phpDocumentor\Reflection\DocBlock\Tags\See
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\Fqsen
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen
*
* @covers ::__construct
* @covers ::create
*/
public function testAnEmptyContextIsCreatedIfNoneIsProvided(): void
public function testAnEmptyContextIsCreatedIfNoneIsProvided() : void
{
$fqsen = '\Tag';
$resolver = m::mock(FqsenResolver::class)
$fqsen = '\Tag';
$resolver = m::mock(FqsenResolver::class)
->shouldReceive('resolve')
->with('Tag', m::type(Context::class))
->andReturn(new Fqsen($fqsen))
@@ -123,15 +126,16 @@ class StandardTagFactoryTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Author
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*
* @covers ::__construct
* @covers ::create
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @uses phpDocumentor\Reflection\DocBlock\Tags\Author
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*/
public function testPassingYourOwnSetOfTagHandlers(): void
public function testPassingYourOwnSetOfTagHandlers() : void
{
$context = new Context('');
$context = new Context('');
$tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class), ['user' => Author::class]);
/** @var Author $tag */
@@ -142,26 +146,30 @@ class StandardTagFactoryTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
*
* @covers ::create
* @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');
$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');
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
*
* @covers ::__construct
* @covers ::addParameter
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
*/
public function testAddParameterToServiceLocator(): void
public function testAddParameterToServiceLocator() : void
{
$resolver = m::mock(FqsenResolver::class);
$resolver = m::mock(FqsenResolver::class);
$tagFactory = new StandardTagFactory($resolver);
$tagFactory->addParameter('myParam', 'myValue');
@@ -173,14 +181,15 @@ class StandardTagFactoryTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
*
* @covers ::addService
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
*/
public function testAddServiceToServiceLocator(): void
public function testAddServiceToServiceLocator() : void
{
$service = new PassthroughFormatter();
$resolver = m::mock(FqsenResolver::class);
$resolver = m::mock(FqsenResolver::class);
$tagFactory = new StandardTagFactory($resolver);
$tagFactory->addService($service);
@@ -192,15 +201,16 @@ class StandardTagFactoryTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
*
* @covers ::addService
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
*/
public function testInjectConcreteServiceForInterfaceToServiceLocator(): void
public function testInjectConcreteServiceForInterfaceToServiceLocator() : void
{
$interfaceName = Formatter::class;
$service = new PassthroughFormatter();
$service = new PassthroughFormatter();
$resolver = m::mock(FqsenResolver::class);
$resolver = m::mock(FqsenResolver::class);
$tagFactory = new StandardTagFactory($resolver);
$tagFactory->addService($service, $interfaceName);
@@ -212,15 +222,16 @@ class StandardTagFactoryTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Author
*
* @covers ::registerTagHandler
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::create
* @uses phpDocumentor\Reflection\DocBlock\Tags\Author
*/
public function testRegisteringAHandlerForANewTag(): void
public function testRegisteringAHandlerForANewTag() : void
{
$resolver = m::mock(FqsenResolver::class);
$resolver = m::mock(FqsenResolver::class);
$tagFactory = new StandardTagFactory($resolver);
$tagFactory->registerTagHandler('my-tag', Author::class);
@@ -231,66 +242,72 @@ class StandardTagFactoryTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
*
* @covers ::registerTagHandler
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
*/
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);
// phpcs:ignore SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName
$tagFactory->registerTagHandler(\Name\Spaced\Tag::class, Author::class);
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
*
* @covers ::registerTagHandler
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
*/
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->registerTagHandler('my-tag', '');
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
*
* @covers ::registerTagHandler
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
*/
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->registerTagHandler('my-tag', 'IDoNotExist');
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
*
* @covers ::registerTagHandler
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
*/
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->registerTagHandler('my-tag', 'stdClass');
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @uses \phpDocumentor\Reflection\Docblock\Description
* @uses \phpDocumentor\Reflection\Docblock\Tags\Return_
* @uses \phpDocumentor\Reflection\Docblock\Tags\BaseTag
*
* @covers ::create
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
* @uses phpDocumentor\Reflection\Docblock\Description
* @uses phpDocumentor\Reflection\Docblock\Tags\Return_
* @uses phpDocumentor\Reflection\Docblock\Tags\BaseTag
*/
public function testReturntagIsMappedCorrectly(): void
public function testReturnTagIsMappedCorrectly() : void
{
$context = new Context('');
+21 -16
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -25,16 +25,17 @@ class AuthorTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__construct
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Author('Mike van Riel', '[email protected]');
@@ -45,10 +46,11 @@ class AuthorTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Author('Mike van Riel', '[email protected]');
@@ -57,9 +59,10 @@ class AuthorTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__construct
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Author('Mike van Riel', '[email protected]');
@@ -73,7 +76,7 @@ class AuthorTest extends TestCase
* @covers ::__construct
* @covers ::getAuthorName
*/
public function testHasTheAuthorName(): void
public function testHasTheAuthorName() : void
{
$expected = 'Mike van Riel';
@@ -86,7 +89,7 @@ class AuthorTest extends TestCase
* @covers ::__construct
* @covers ::getEmail
*/
public function testHasTheAuthorMailAddress(): void
public function testHasTheAuthorMailAddress() : void
{
$expected = '[email protected]';
@@ -98,7 +101,7 @@ class AuthorTest extends TestCase
/**
* @covers ::__construct
*/
public function testInitializationFailsIfEmailIsNotValid(): void
public function testInitializationFailsIfEmailIsNotValid() : void
{
$this->expectException('InvalidArgumentException');
new Author('Mike van Riel', 'mike');
@@ -108,7 +111,7 @@ class AuthorTest extends TestCase
* @covers ::__construct
* @covers ::__toString
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Author('Mike van Riel', '[email protected]');
@@ -119,7 +122,7 @@ class AuthorTest extends TestCase
* @covers ::__construct
* @covers ::__toString
*/
public function testStringRepresentationWithEmtpyEmail(): void
public function testStringRepresentationWithEmtpyEmail() : void
{
$fixture = new Author('Mike van Riel', '');
@@ -127,10 +130,11 @@ class AuthorTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::<public>
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$fixture = Author::create('Mike van Riel <[email protected]>');
@@ -140,10 +144,11 @@ class AuthorTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::<public>
*
* @covers ::create
*/
public function testFactoryMethodReturnsNullIfItCouldNotReadBody(): void
public function testFactoryMethodReturnsNullIfItCouldNotReadBody() : void
{
$this->assertNull(Author::create('dfgr<'));
}
+24 -18
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -30,7 +30,7 @@ class CoversTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -38,9 +38,10 @@ class CoversTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Covers::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Covers(new Fqsen('\DateTime'), new Description('Description'));
@@ -52,10 +53,11 @@ class CoversTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Covers::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Covers(new Fqsen('\DateTime'), new Description('Description'));
@@ -65,9 +67,10 @@ class CoversTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Covers::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Covers(new Fqsen('\DateTime'), new Description('Description'));
@@ -81,7 +84,7 @@ class CoversTest extends TestCase
* @covers ::__construct
* @covers ::getReference
*/
public function testHasReferenceToFqsen(): void
public function testHasReferenceToFqsen() : void
{
$expected = new Fqsen('\DateTime');
@@ -91,11 +94,12 @@ class CoversTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -105,11 +109,12 @@ class CoversTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Covers(new Fqsen('\DateTime'), new Description('Description'));
@@ -117,21 +122,22 @@ class CoversTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Covers::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\FqsenResolver
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Fqsen
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = m::mock(FqsenResolver::class);
$context = new Context('');
$resolver = m::mock(FqsenResolver::class);
$context = new Context('');
$fqsen = new Fqsen('\DateTime');
$fqsen = new Fqsen('\DateTime');
$description = new Description('My Description');
$descriptionFactory
@@ -148,7 +154,7 @@ class CoversTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfBodyIsNotEmpty(): void
public function testFactoryMethodFailsIfBodyIsNotEmpty() : void
{
$this->expectException('InvalidArgumentException');
$this->assertNull(Covers::create(''));
+28 -20
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -28,7 +28,7 @@ class DeprecatedTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -36,9 +36,10 @@ class DeprecatedTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Deprecated('1.0', new Description('Description'));
@@ -50,10 +51,11 @@ class DeprecatedTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Deprecated('1.0', new Description('Description'));
@@ -63,9 +65,10 @@ class DeprecatedTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Deprecated('1.0', new Description('Description'));
@@ -79,7 +82,7 @@ class DeprecatedTest extends TestCase
* @covers ::__construct
* @covers ::getVersion
*/
public function testHasVersionNumber(): void
public function testHasVersionNumber() : void
{
$expected = '1.0';
@@ -89,11 +92,12 @@ class DeprecatedTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -103,11 +107,12 @@ class DeprecatedTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Deprecated('1.0', new Description('Description'));
@@ -115,18 +120,19 @@ class DeprecatedTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$context = new Context('');
$context = new Context('');
$version = '1.0';
$version = '1.0';
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -139,13 +145,14 @@ class DeprecatedTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethodCreatesEmptyDeprecatedTag(): void
public function testFactoryMethodCreatesEmptyDeprecatedTag() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$descriptionFactory->shouldReceive('create')->never();
@@ -158,10 +165,11 @@ class DeprecatedTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::__construct
*
* @covers ::create
*/
public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex(): void
public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() : void
{
$this->assertEquals(new Deprecated(), Deprecated::create('dkhf<'));
}
+22 -14
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
namespace DocBlock\Tags;
@@ -14,18 +16,19 @@ class ExampleTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
/**
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*
* @covers ::create
* @covers ::__construct
* @covers ::getContent
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*/
public function testExampleWithoutContent(): void
public function testExampleWithoutContent() : void
{
$tag = Example::create('"example1.php"');
$this->assertEquals('"example1.php"', $tag->getContent());
@@ -34,13 +37,14 @@ class ExampleTest extends TestCase
}
/**
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*
* @covers ::create
* @covers ::__construct
* @covers ::getFilePath
* @covers ::getDescription
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*/
public function testWithDescription(): void
public function testWithDescription() : void
{
$tag = Example::create('"example1.php" some text');
$this->assertEquals('example1.php', $tag->getFilePath());
@@ -48,13 +52,14 @@ class ExampleTest extends TestCase
}
/**
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*
* @covers ::create
* @covers ::__construct
* @covers ::getFilePath
* @covers ::getStartingLine
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*/
public function testStartlineIsParsed(): void
public function testStartlineIsParsed() : void
{
$tag = Example::create('"example1.php" 10');
$this->assertEquals('example1.php', $tag->getFilePath());
@@ -62,14 +67,15 @@ class ExampleTest extends TestCase
}
/**
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*
* @covers ::create
* @covers ::__construct
* @covers ::getFilePath
* @covers ::getStartingLine
* @covers ::getDescription
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*/
public function testAllowOmitingLineCount(): void
public function testAllowOmitingLineCount() : void
{
$tag = Example::create('"example1.php" 10 some text');
$this->assertEquals('example1.php', $tag->getFilePath());
@@ -78,14 +84,15 @@ class ExampleTest extends TestCase
}
/**
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*
* @covers ::create
* @covers ::__construct
* @covers ::getFilePath
* @covers ::getStartingLine
* @covers ::getLineCount
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*/
public function testLengthIsParsed(): void
public function testLengthIsParsed() : void
{
$tag = Example::create('"example1.php" 10 5');
$this->assertEquals('example1.php', $tag->getFilePath());
@@ -94,15 +101,16 @@ class ExampleTest extends TestCase
}
/**
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*
* @covers ::create
* @covers ::__construct
* @covers ::getFilePath
* @covers ::getStartingLine
* @covers ::getLineCount
* @covers ::getDescription
* @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*/
public function testFullExample(): void
public function testFullExample() : void
{
$tag = Example::create('"example1.php" 10 5 test text');
$this->assertEquals('example1.php', $tag->getFilePath());
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,17 +8,14 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Jan Schneider <jan@horde.org>
* @copyright 2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\DocBlock\Tags\Formatter;
use Mockery as m;
use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\Tags\Link;
use phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag;
use phpDocumentor\Reflection\DocBlock\Tags\Param;
use phpDocumentor\Reflection\DocBlock\Tags\Version;
use phpDocumentor\Reflection\Types\String_;
@@ -30,27 +29,28 @@ class AlignFormatterTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Link
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Param
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Version
* @uses \phpDocumentor\Reflection\Types\String_
*
* @covers ::format
* @covers \phpDocumentor\Reflection\DocBlock\Tags\Formatter\AlignFormatter::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Link
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Param
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Version
* @uses \phpDocumentor\Reflection\Types\String_
*/
public function testFormatterCallsToStringAndReturnsAStandardRepresentation(): void
public function testFormatterCallsToStringAndReturnsAStandardRepresentation() : void
{
$tags = [
$tags = [
new Param('foobar', new String_()),
new Version('1.2.0'),
new Link('http://www.example.com', new Description('Examples')),
new LinkTag('http://www.example.com', new Description('Examples')),
];
$fixture = new AlignFormatter($tags);
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,9 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\DocBlock\Tags\Formatter;
@@ -26,18 +26,19 @@ class PassthroughFormatterTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
/**
* @covers ::format
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
*
* @covers ::format
*/
public function testFormatterCallsToStringAndReturnsAStandardRepresentation(): void
public function testFormatterCallsToStringAndReturnsAStandardRepresentation() : void
{
$expected = '@unknown-tag This is a description';
@@ -50,15 +51,16 @@ class PassthroughFormatterTest extends TestCase
}
/**
* @covers ::format
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic
*
* @covers ::format
*/
public function testFormatterToStringWitoutDescription(): void
public function testFormatterToStringWitoutDescription() : void
{
$expected = '@unknown-tag';
$fixture = new PassthroughFormatter();
$fixture = new PassthroughFormatter();
$this->assertSame(
$expected,
+24 -18
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @generic http://phpdoc.org
*/
@@ -28,7 +28,7 @@ class GenericTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -36,9 +36,10 @@ class GenericTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Generic('generic', new Description('Description'));
@@ -51,9 +52,10 @@ class GenericTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Generic('generic', new Description('Description'));
@@ -63,9 +65,10 @@ class GenericTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Generic('generic', new Description('Description'));
@@ -76,11 +79,12 @@ class GenericTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -90,12 +94,13 @@ class GenericTest extends TestCase
}
/**
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*
* @covers ::__construct
* @covers ::__toString
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Generic('generic', new Description('Description'));
@@ -103,18 +108,19 @@ class GenericTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$context = new Context('');
$context = new Context('');
$generics = 'generic';
$generics = 'generic';
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -129,7 +135,7 @@ class GenericTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfNameIsNotEmpty(): void
public function testFactoryMethodFailsIfNameIsNotEmpty() : void
{
$this->expectException('InvalidArgumentException');
Generic::create('', '');
@@ -139,7 +145,7 @@ class GenericTest extends TestCase
* @covers ::create
* @covers ::__construct
*/
public function testFactoryMethodFailsIfNameContainsIllegalCharacters(): void
public function testFactoryMethodFailsIfNameContainsIllegalCharacters() : void
{
$this->expectException('InvalidArgumentException');
Generic::create('', 'name/myname');
+25 -18
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -28,7 +28,7 @@ class LinkTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -36,9 +36,10 @@ class LinkTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Link::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Link('http://this.is.my/link', new Description('Description'));
@@ -50,10 +51,11 @@ class LinkTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Link::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Link('http://this.is.my/link', new Description('Description'));
@@ -63,9 +65,10 @@ class LinkTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Link::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Link('http://this.is.my/link', new Description('Description'));
@@ -79,7 +82,7 @@ class LinkTest extends TestCase
* @covers ::__construct
* @covers ::getLink
*/
public function testHasLinkUrl(): void
public function testHasLinkUrl() : void
{
$expected = 'http://this.is.my/link';
@@ -89,11 +92,12 @@ class LinkTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -103,11 +107,12 @@ class LinkTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Link('http://this.is.my/link', new Description('Description'));
@@ -115,18 +120,19 @@ class LinkTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Link::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$context = new Context('');
$context = new Context('');
$links = 'http://this.is.my/link';
$links = 'http://this.is.my/link';
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -139,13 +145,14 @@ class LinkTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Link::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethodCreatesEmptyLinkTag(): void
public function testFactoryMethodCreatesEmptyLinkTag() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$descriptionFactory->shouldReceive('create')->never();
+99 -93
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -37,16 +37,17 @@ class MethodTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::__construct
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Method('myMethod');
@@ -59,16 +60,24 @@ class MethodTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$arguments = [
['name' => 'argument1', 'type' => new String_()],
['name' => 'argument2', 'type' => new Object_()],
];
$fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description'));
$fixture = new Method(
'myMethod',
$arguments,
new Void_(),
true,
new Description('My Description')
);
$this->assertSame(
'@method static void myMethod(string $argument1, object $argument2) My Description',
@@ -79,9 +88,10 @@ class MethodTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Method('myMethod');
@@ -95,7 +105,7 @@ class MethodTest extends TestCase
* @covers ::__construct
* @covers ::getMethodName
*/
public function testHasMethodName(): void
public function testHasMethodName() : void
{
$expected = 'myMethod';
@@ -108,7 +118,7 @@ class MethodTest extends TestCase
* @covers ::__construct
* @covers ::getArguments
*/
public function testHasArguments(): void
public function testHasArguments() : void
{
$arguments = [
['name' => 'argument1', 'type' => new String_()],
@@ -123,10 +133,10 @@ class MethodTest extends TestCase
* @covers ::__construct
* @covers ::getArguments
*/
public function testArgumentsMayBePassedAsString(): void
public function testArgumentsMayBePassedAsString() : void
{
$arguments = ['argument1'];
$expected = [
$expected = [
['name' => $arguments[0], 'type' => new Void_()],
];
@@ -139,10 +149,10 @@ class MethodTest extends TestCase
* @covers ::__construct
* @covers ::getArguments
*/
public function testArgumentTypeCanBeInferredAsVoid(): void
public function testArgumentTypeCanBeInferredAsVoid() : void
{
$arguments = [['name' => 'argument1']];
$expected = [
$expected = [
['name' => $arguments[0]['name'], 'type' => new Void_()],
];
@@ -152,12 +162,13 @@ class MethodTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::getArguments
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::create
*/
public function testRestArgumentIsParsedAsRegularArg(): void
public function testRestArgumentIsParsedAsRegularArg() : void
{
$expected = [
['name' => 'arg1', 'type' => new Void_()],
@@ -166,9 +177,9 @@ class MethodTest extends TestCase
];
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = new TypeResolver();
$context = new Context('');
$description = new Description('');
$resolver = new TypeResolver();
$context = new Context('');
$description = new Description('');
$descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description);
$fixture = Method::create(
@@ -185,7 +196,7 @@ class MethodTest extends TestCase
* @covers ::__construct
* @covers ::getReturnType
*/
public function testHasReturnType(): void
public function testHasReturnType() : void
{
$expected = new String_();
@@ -198,7 +209,7 @@ class MethodTest extends TestCase
* @covers ::__construct
* @covers ::getReturnType
*/
public function testReturnTypeCanBeInferredAsVoid(): void
public function testReturnTypeCanBeInferredAsVoid() : void
{
$fixture = new Method('myMethod', []);
@@ -209,23 +220,24 @@ class MethodTest extends TestCase
* @covers ::__construct
* @covers ::isStatic
*/
public function testMethodCanBeStatic(): void
public function testMethodCanBeStatic() : void
{
$expected = false;
$fixture = new Method('myMethod', [], null, $expected);
$fixture = new Method('myMethod', [], null, $expected);
$this->assertSame($expected, $fixture->isStatic());
$expected = true;
$fixture = new Method('myMethod', [], null, $expected);
$fixture = new Method('myMethod', [], null, $expected);
$this->assertSame($expected, $fixture->isStatic());
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -235,18 +247,19 @@ class MethodTest extends TestCase
}
/**
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::isStatic
*
* @covers ::__construct
* @covers ::__toString
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$arguments = [
['name' => 'argument1', 'type' => new String_()],
['name' => 'argument2', 'type' => new Object_()],
];
$fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description'));
$fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description'));
$this->assertSame(
'static void myMethod(string $argument1, object $argument2) My Description',
@@ -255,21 +268,22 @@ class MethodTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Fqsen
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = new TypeResolver();
$context = new Context('');
$resolver = new TypeResolver();
$context = new Context('');
$description = new Description('My Description');
$description = new Description('My Description');
$expectedArguments = [
['name' => 'argument1', 'type' => new String_()],
['name' => 'argument2', 'type' => new Void_()],
@@ -292,17 +306,18 @@ class MethodTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
* @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testReturnTypeThis(): void
public function testReturnTypeThis() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = new TypeResolver();
$context = new Context('');
$resolver = new TypeResolver();
$context = new Context('');
$description = new Description('');
@@ -321,52 +336,58 @@ class MethodTest extends TestCase
$this->assertInstanceOf(This::class, $fixture->getReturnType());
}
public function collectionReturnTypesProvider()
/**
* @return string[][]
*/
public function collectionReturnTypesProvider() : array
{
return [
['int[]', Array_::class, Integer::class, Compound::class],
['int[][]', Array_::class, Array_::class, Compound::class],
['int[]', Array_::class, Integer::class, Compound::class],
['int[][]', Array_::class, Array_::class, Compound::class],
['Object[]', Array_::class, Object_::class, Compound::class],
['array[]', Array_::class, Array_::class, Compound::class],
['array[]', Array_::class, Array_::class, Compound::class],
];
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\Types\Array_
* @uses \phpDocumentor\Reflection\Types\Compound
* @uses \phpDocumentor\Reflection\Types\Integer
* @uses \phpDocumentor\Reflection\Types\Object_
*
* @dataProvider collectionReturnTypesProvider
* @covers ::create
* @uses phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
* @uses phpDocumentor\Reflection\DocBlock\Description
* @uses phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses phpDocumentor\Reflection\TypeResolver
* @uses phpDocumentor\Reflection\Types\Array_
* @uses phpDocumentor\Reflection\Types\Compound
* @uses phpDocumentor\Reflection\Types\Integer
* @uses phpDocumentor\Reflection\Types\Object_
*/
public function testCollectionReturnTypes(
string $returnType,
string $expectedType,
?string $expectedValueType = null,
?string $expectedKeyType = null
): void {
$resolver = new TypeResolver();
) : void {
$resolver = new TypeResolver();
$descriptionFactory = m::mock(DescriptionFactory::class);
$descriptionFactory->shouldReceive('create')->with('', null)->andReturn(new Description(''));
$fixture = Method::create("${returnType} myMethod(\$arg)", $resolver, $descriptionFactory);
$fixture = Method::create("${returnType} myMethod(\$arg)", $resolver, $descriptionFactory);
$returnType = $fixture->getReturnType();
$this->assertInstanceOf($expectedType, $returnType);
if ($returnType instanceof Array_) {
$this->assertInstanceOf($expectedValueType, $returnType->getValueType());
$this->assertInstanceOf($expectedKeyType, $returnType->getKeyType());
if (!($returnType instanceof Array_)) {
return;
}
$this->assertInstanceOf($expectedValueType, $returnType->getValueType());
$this->assertInstanceOf($expectedKeyType, $returnType->getKeyType());
}
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfBodyIsEmpty(): void
public function testFactoryMethodFailsIfBodyIsEmpty() : void
{
$this->expectException('InvalidArgumentException');
Method::create('');
@@ -375,7 +396,7 @@ class MethodTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodReturnsNullIfBodyIsIncorrect(): void
public function testFactoryMethodReturnsNullIfBodyIsIncorrect() : void
{
$this->expectException('InvalidArgumentException');
$this->assertNull(Method::create('body('));
@@ -384,7 +405,7 @@ class MethodTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfResolverIsNull(): void
public function testFactoryMethodFailsIfResolverIsNull() : void
{
$this->expectException('InvalidArgumentException');
Method::create('body');
@@ -393,7 +414,7 @@ class MethodTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{
$this->expectException('InvalidArgumentException');
Method::create('body', new TypeResolver());
@@ -402,16 +423,7 @@ class MethodTest extends TestCase
/**
* @covers ::__construct
*/
public function testCreationFailsIfBodyIsNotString(): void
{
$this->expectException('InvalidArgumentException');
new Method([]);
}
/**
* @covers ::__construct
*/
public function testCreationFailsIfBodyIsEmpty(): void
public function testCreationFailsIfBodyIsEmpty() : void
{
$this->expectException('InvalidArgumentException');
new Method('');
@@ -420,35 +432,27 @@ class MethodTest extends TestCase
/**
* @covers ::__construct
*/
public function testCreationFailsIfStaticIsNotBoolean(): void
{
$this->expectException('InvalidArgumentException');
new Method('body', [], null, []);
}
/**
* @covers ::__construct
*/
public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void
public function testCreationFailsIfArgumentRecordContainsInvalidEntry() : void
{
$this->expectException('InvalidArgumentException');
new Method('body', [['name' => 'myName', 'unknown' => 'nah']]);
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Fqsen
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testCreateMethodParenthesisMissing(): void
public function testCreateMethodParenthesisMissing() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = new TypeResolver();
$context = new Context('');
$resolver = new TypeResolver();
$context = new Context('');
$description = new Description('My Description');
@@ -469,7 +473,6 @@ class MethodTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\TypeResolver
@@ -477,12 +480,14 @@ class MethodTest extends TestCase
* @uses \phpDocumentor\Reflection\Fqsen
* @uses \phpDocumentor\Reflection\Types\Context
* @uses \phpDocumentor\Reflection\Types\Void_
*
* @covers ::create
*/
public function testCreateWithoutReturnType(): void
public function testCreateWithoutReturnType() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = new TypeResolver();
$context = new Context('');
$resolver = new TypeResolver();
$context = new Context('');
$description = new Description('');
@@ -503,7 +508,6 @@ class MethodTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\TypeResolver
@@ -514,12 +518,14 @@ class MethodTest extends TestCase
* @uses \phpDocumentor\Reflection\Types\Compound
* @uses \phpDocumentor\Reflection\Types\Integer
* @uses \phpDocumentor\Reflection\Types\Object_
*
* @covers ::create
*/
public function testCreateWithMixedReturnTypes(): void
public function testCreateWithMixedReturnTypes() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = new TypeResolver();
$context = new Context('');
$resolver = new TypeResolver();
$context = new Context('');
$descriptionFactory->shouldReceive('create')->andReturn(new Description(''));
+32 -24
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -30,7 +30,7 @@ class ParamTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -38,9 +38,10 @@ class ParamTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Param('myParameter', null, false, new Description('Description'));
@@ -53,10 +54,11 @@ class ParamTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Param('myParameter', new String_(), true, new Description('Description'));
$this->assertSame('@param string ...$myParameter Description', $fixture->render());
@@ -73,9 +75,10 @@ class ParamTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::__construct
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Param('myParameter');
@@ -89,7 +92,7 @@ class ParamTest extends TestCase
* @covers ::__construct
* @covers ::getVariableName
*/
public function testHasVariableName(): void
public function testHasVariableName() : void
{
$expected = 'myParameter';
@@ -102,7 +105,7 @@ class ParamTest extends TestCase
* @covers ::__construct
* @covers ::getType
*/
public function testHasType(): void
public function testHasType() : void
{
$expected = new String_();
@@ -115,7 +118,7 @@ class ParamTest extends TestCase
* @covers ::__construct
* @covers ::isVariadic
*/
public function testIfParameterIsVariadic(): void
public function testIfParameterIsVariadic() : void
{
$fixture = new Param('myParameter', new String_(), false);
$this->assertFalse($fixture->isVariadic());
@@ -125,11 +128,12 @@ class ParamTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -139,13 +143,14 @@ class ParamTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\String_
*
* @covers ::__construct
* @covers ::isVariadic
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\String_
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Param('myParameter', new String_(), true, new Description('Description'));
@@ -153,17 +158,18 @@ class ParamTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$typeResolver = new TypeResolver();
$typeResolver = new TypeResolver();
$descriptionFactory = m::mock(DescriptionFactory::class);
$context = new Context('');
$context = new Context('');
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -178,12 +184,13 @@ class ParamTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::<public>
* @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
*
* @covers ::create
*/
public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
{
$this->expectException('InvalidArgumentException');
$descriptionFactory = m::mock(DescriptionFactory::class);
@@ -193,17 +200,18 @@ class ParamTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfResolverIsNull(): void
public function testFactoryMethodFailsIfResolverIsNull() : void
{
$this->expectException('InvalidArgumentException');
Param::create('body');
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\TypeResolver
*
* @covers ::create
*/
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{
$this->expectException('InvalidArgumentException');
Param::create('body', new TypeResolver());
+31 -23
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -30,7 +30,7 @@ class PropertyReadTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -38,9 +38,10 @@ class PropertyReadTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new PropertyRead('myProperty', null, new Description('Description'));
@@ -52,10 +53,11 @@ class PropertyReadTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new PropertyRead('myProperty', new String_(), new Description('Description'));
$this->assertSame('@property-read string $myProperty Description', $fixture->render());
@@ -69,9 +71,10 @@ class PropertyReadTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::__construct
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new PropertyRead('myProperty');
@@ -85,7 +88,7 @@ class PropertyReadTest extends TestCase
* @covers ::__construct
* @covers ::getVariableName
*/
public function testHasVariableName(): void
public function testHasVariableName() : void
{
$expected = 'myProperty';
@@ -98,7 +101,7 @@ class PropertyReadTest extends TestCase
* @covers ::__construct
* @covers ::getType
*/
public function testHasType(): void
public function testHasType() : void
{
$expected = new String_();
@@ -108,11 +111,12 @@ class PropertyReadTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -122,12 +126,13 @@ class PropertyReadTest extends TestCase
}
/**
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\String_
*
* @covers ::__construct
* @covers ::__toString
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new PropertyRead('myProperty', new String_(), new Description('Description'));
@@ -135,17 +140,18 @@ class PropertyReadTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$typeResolver = new TypeResolver();
$typeResolver = new TypeResolver();
$descriptionFactory = m::mock(DescriptionFactory::class);
$context = new Context('');
$context = new Context('');
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -164,12 +170,13 @@ class PropertyReadTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::<public>
* @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
*
* @covers ::create
*/
public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
{
$this->expectException('InvalidArgumentException');
$descriptionFactory = m::mock(DescriptionFactory::class);
@@ -179,17 +186,18 @@ class PropertyReadTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfResolverIsNull(): void
public function testFactoryMethodFailsIfResolverIsNull() : void
{
$this->expectException('InvalidArgumentException');
PropertyRead::create('body');
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\TypeResolver
*
* @covers ::create
*/
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{
$this->expectException('InvalidArgumentException');
PropertyRead::create('body', new TypeResolver());
+31 -23
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -30,7 +30,7 @@ class PropertyTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -38,9 +38,10 @@ class PropertyTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Property('myProperty', null, new Description('Description'));
@@ -52,10 +53,11 @@ class PropertyTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Property('myProperty', new String_(), new Description('Description'));
$this->assertSame('@property string $myProperty Description', $fixture->render());
@@ -69,9 +71,10 @@ class PropertyTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::__construct
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Property('myProperty');
@@ -85,7 +88,7 @@ class PropertyTest extends TestCase
* @covers ::__construct
* @covers ::getVariableName
*/
public function testHasVariableName(): void
public function testHasVariableName() : void
{
$expected = 'myProperty';
@@ -98,7 +101,7 @@ class PropertyTest extends TestCase
* @covers ::__construct
* @covers ::getType
*/
public function testHasType(): void
public function testHasType() : void
{
$expected = new String_();
@@ -108,11 +111,12 @@ class PropertyTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -122,12 +126,13 @@ class PropertyTest extends TestCase
}
/**
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\String_
*
* @covers ::__construct
* @covers ::__toString
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Property('myProperty', new String_(), new Description('Description'));
@@ -135,17 +140,18 @@ class PropertyTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$typeResolver = new TypeResolver();
$typeResolver = new TypeResolver();
$descriptionFactory = m::mock(DescriptionFactory::class);
$context = new Context('');
$context = new Context('');
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -159,12 +165,13 @@ class PropertyTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::<public>
* @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
*
* @covers ::create
*/
public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
{
$this->expectException('InvalidArgumentException');
$descriptionFactory = m::mock(DescriptionFactory::class);
@@ -174,17 +181,18 @@ class PropertyTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfResolverIsNull(): void
public function testFactoryMethodFailsIfResolverIsNull() : void
{
$this->expectException('InvalidArgumentException');
Property::create('body');
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\TypeResolver
*
* @covers ::create
*/
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{
$this->expectException('InvalidArgumentException');
Property::create('body', new TypeResolver());
+31 -23
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -30,7 +30,7 @@ class PropertyWriteTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -38,9 +38,10 @@ class PropertyWriteTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new PropertyWrite('myProperty', null, new Description('Description'));
@@ -52,10 +53,11 @@ class PropertyWriteTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new PropertyWrite('myProperty', new String_(), new Description('Description'));
$this->assertSame('@property-write string $myProperty Description', $fixture->render());
@@ -69,9 +71,10 @@ class PropertyWriteTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::__construct
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new PropertyWrite('myProperty');
@@ -85,7 +88,7 @@ class PropertyWriteTest extends TestCase
* @covers ::__construct
* @covers ::getVariableName
*/
public function testHasVariableName(): void
public function testHasVariableName() : void
{
$expected = 'myProperty';
@@ -98,7 +101,7 @@ class PropertyWriteTest extends TestCase
* @covers ::__construct
* @covers ::getType
*/
public function testHasType(): void
public function testHasType() : void
{
$expected = new String_();
@@ -108,11 +111,12 @@ class PropertyWriteTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -122,12 +126,13 @@ class PropertyWriteTest extends TestCase
}
/**
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\String_
*
* @covers ::__construct
* @covers ::__toString
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new PropertyWrite('myProperty', new String_(), new Description('Description'));
@@ -135,17 +140,18 @@ class PropertyWriteTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$typeResolver = new TypeResolver();
$typeResolver = new TypeResolver();
$descriptionFactory = m::mock(DescriptionFactory::class);
$context = new Context('');
$context = new Context('');
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -164,12 +170,13 @@ class PropertyWriteTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::<public>
* @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
*
* @covers ::create
*/
public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
{
$this->expectException('InvalidArgumentException');
$descriptionFactory = m::mock(DescriptionFactory::class);
@@ -179,17 +186,18 @@ class PropertyWriteTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfResolverIsNull(): void
public function testFactoryMethodFailsIfResolverIsNull() : void
{
$this->expectException('InvalidArgumentException');
PropertyWrite::create('body');
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\TypeResolver
*
* @covers ::create
*/
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{
$this->expectException('InvalidArgumentException');
PropertyWrite::create('body', new TypeResolver());
+26 -20
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -30,7 +30,7 @@ class ReturnTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -38,9 +38,10 @@ class ReturnTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Return_(new String_(), new Description('Description'));
@@ -52,10 +53,11 @@ class ReturnTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Return_(new String_(), new Description('Description'));
@@ -65,9 +67,10 @@ class ReturnTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Return_(new String_(), new Description('Description'));
@@ -81,7 +84,7 @@ class ReturnTest extends TestCase
* @covers ::__construct
* @covers ::getType
*/
public function testHasType(): void
public function testHasType() : void
{
$expected = new String_();
@@ -91,11 +94,12 @@ class ReturnTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -105,11 +109,12 @@ class ReturnTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Return_(new String_(), new Description('Description'));
@@ -117,21 +122,22 @@ class ReturnTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\String_
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = new TypeResolver();
$context = new Context('');
$resolver = new TypeResolver();
$context = new Context('');
$type = new String_();
$type = new String_();
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -145,7 +151,7 @@ class ReturnTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfBodyIsNotEmpty(): void
public function testFactoryMethodFailsIfBodyIsNotEmpty() : void
{
$this->expectException('InvalidArgumentException');
$this->assertNull(Return_::create(''));
@@ -154,7 +160,7 @@ class ReturnTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfResolverIsNull(): void
public function testFactoryMethodFailsIfResolverIsNull() : void
{
$this->expectException('InvalidArgumentException');
Return_::create('body');
@@ -163,7 +169,7 @@ class ReturnTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{
$this->expectException('InvalidArgumentException');
Return_::create('body', new TypeResolver());
+34 -26
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -32,7 +32,7 @@ class SeeTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -42,9 +42,10 @@ class SeeTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen
* @uses \phpDocumentor\Reflection\Fqsen
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new See(new FqsenRef(new Fqsen('\DateTime')), new Description('Description'));
@@ -57,10 +58,11 @@ class SeeTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new See(new FqsenRef(new Fqsen('\DateTime')), new Description('Description'));
@@ -72,9 +74,10 @@ class SeeTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen
* @uses \phpDocumentor\Reflection\Fqsen
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new See(new FqsenRef(new Fqsen('\DateTime')), new Description('Description'));
@@ -87,10 +90,11 @@ class SeeTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen
* @uses \phpDocumentor\Reflection\Fqsen
*
* @covers ::__construct
* @covers ::getReference
*/
public function testHasReferenceToFqsen(): void
public function testHasReferenceToFqsen() : void
{
$expected = new FqsenRef(new Fqsen('\DateTime'));
@@ -100,13 +104,14 @@ class SeeTest extends TestCase
}
/**
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen
* @uses \phpDocumentor\Reflection\Fqsen
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -116,13 +121,14 @@ class SeeTest extends TestCase
}
/**
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen
* @uses \phpDocumentor\Reflection\Fqsen
*
* @covers ::__construct
* @covers ::__toString
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new See(new FqsenRef(new Fqsen('\DateTime::format()')), new Description('Description'));
@@ -130,7 +136,6 @@ class SeeTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\See::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\FqsenResolver
@@ -138,14 +143,16 @@ class SeeTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen
* @uses \phpDocumentor\Reflection\Fqsen
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = m::mock(FqsenResolver::class);
$context = new Context('');
$resolver = m::mock(FqsenResolver::class);
$context = new Context('');
$fqsen = new Fqsen('\DateTime');
$fqsen = new Fqsen('\DateTime');
$description = new Description('My Description');
$descriptionFactory
@@ -161,19 +168,20 @@ class SeeTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\See::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\FqsenResolver
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethodWithUrl(): void
public function testFactoryMethodWithUrl() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = m::mock(FqsenResolver::class);
$context = new Context('');
$resolver = m::mock(FqsenResolver::class);
$context = new Context('');
$description = new Description('My Description');
@@ -193,7 +201,7 @@ class SeeTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfBodyIsNotEmpty(): void
public function testFactoryMethodFailsIfBodyIsNotEmpty() : void
{
$this->expectException('InvalidArgumentException');
$this->assertNull(See::create(''));
@@ -202,7 +210,7 @@ class SeeTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfResolverIsNull(): void
public function testFactoryMethodFailsIfResolverIsNull() : void
{
$this->expectException('InvalidArgumentException');
See::create('body');
@@ -211,7 +219,7 @@ class SeeTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{
$this->expectException('InvalidArgumentException');
See::create('body', new FqsenResolver());
+26 -19
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -28,7 +28,7 @@ class SinceTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -36,9 +36,10 @@ class SinceTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Since::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Since('1.0', new Description('Description'));
@@ -50,10 +51,11 @@ class SinceTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Since::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Since('1.0', new Description('Description'));
@@ -63,9 +65,10 @@ class SinceTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Since::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Since('1.0', new Description('Description'));
@@ -79,7 +82,7 @@ class SinceTest extends TestCase
* @covers ::__construct
* @covers ::getVersion
*/
public function testHasVersionNumber(): void
public function testHasVersionNumber() : void
{
$expected = '1.0';
@@ -89,11 +92,12 @@ class SinceTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -103,11 +107,12 @@ class SinceTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Since('1.0', new Description('Description'));
@@ -115,18 +120,19 @@ class SinceTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Since::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$context = new Context('');
$context = new Context('');
$version = '1.0';
$version = '1.0';
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -139,13 +145,14 @@ class SinceTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Since::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethodCreatesEmptySinceTag(): void
public function testFactoryMethodCreatesEmptySinceTag() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$descriptionFactory->shouldReceive('create')->never();
@@ -160,7 +167,7 @@ class SinceTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex(): void
public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() : void
{
$this->assertNull(Since::create('dkhf<'));
}
+31 -23
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -28,7 +28,7 @@ class SourceTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -36,9 +36,10 @@ class SourceTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Source::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Source(1, null, new Description('Description'));
@@ -50,10 +51,11 @@ class SourceTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Source::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Source(1, 10, new Description('Description'));
$this->assertSame('@source 1 10 Description', $fixture->render());
@@ -67,9 +69,10 @@ class SourceTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Source::__construct
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Source(1);
@@ -83,7 +86,7 @@ class SourceTest extends TestCase
* @covers ::__construct
* @covers ::getStartingLine
*/
public function testHasStartingLine(): void
public function testHasStartingLine() : void
{
$expected = 1;
@@ -96,7 +99,7 @@ class SourceTest extends TestCase
* @covers ::__construct
* @covers ::getLineCount
*/
public function testHasLineCount(): void
public function testHasLineCount() : void
{
$expected = 2;
@@ -106,11 +109,12 @@ class SourceTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -120,12 +124,13 @@ class SourceTest extends TestCase
}
/**
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\String_
*
* @covers ::__construct
* @covers ::__toString
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Source(1, 10, new Description('Description'));
@@ -133,16 +138,17 @@ class SourceTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Source::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$context = new Context('');
$context = new Context('');
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -156,12 +162,13 @@ class SourceTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Source::<public>
* @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
*
* @covers ::create
*/
public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
{
$this->expectException('InvalidArgumentException');
$descriptionFactory = m::mock(DescriptionFactory::class);
@@ -169,10 +176,11 @@ class SourceTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\TypeResolver
*
* @covers ::create
*/
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{
$this->expectException('InvalidArgumentException');
Source::create('1');
@@ -181,7 +189,7 @@ class SourceTest extends TestCase
/**
* @covers ::__construct
*/
public function testExceptionIsThrownIfStartingLineIsNotInteger(): void
public function testExceptionIsThrownIfStartingLineIsNotInteger() : void
{
$this->expectException('InvalidArgumentException');
new Source('blabla');
@@ -190,7 +198,7 @@ class SourceTest extends TestCase
/**
* @covers ::__construct
*/
public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull(): void
public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull() : void
{
$this->expectException('InvalidArgumentException');
new Source('1', []);
+26 -20
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -30,7 +30,7 @@ class ThrowsTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -38,9 +38,10 @@ class ThrowsTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Throws(new String_(), new Description('Description'));
@@ -52,10 +53,11 @@ class ThrowsTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Throws(new String_(), new Description('Description'));
@@ -65,9 +67,10 @@ class ThrowsTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Throws(new String_(), new Description('Description'));
@@ -81,7 +84,7 @@ class ThrowsTest extends TestCase
* @covers ::__construct
* @covers ::getType
*/
public function testHasType(): void
public function testHasType() : void
{
$expected = new String_();
@@ -91,11 +94,12 @@ class ThrowsTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -105,11 +109,12 @@ class ThrowsTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Throws(new String_(), new Description('Description'));
@@ -117,21 +122,22 @@ class ThrowsTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\String_
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = new TypeResolver();
$context = new Context('');
$resolver = new TypeResolver();
$context = new Context('');
$type = new String_();
$type = new String_();
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -145,7 +151,7 @@ class ThrowsTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfBodyIsNotEmpty(): void
public function testFactoryMethodFailsIfBodyIsNotEmpty() : void
{
$this->expectException('InvalidArgumentException');
$this->assertNull(Throws::create(''));
@@ -154,7 +160,7 @@ class ThrowsTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfResolverIsNull(): void
public function testFactoryMethodFailsIfResolverIsNull() : void
{
$this->expectException('InvalidArgumentException');
Throws::create('body');
@@ -163,7 +169,7 @@ class ThrowsTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{
$this->expectException('InvalidArgumentException');
Throws::create('body', new TypeResolver());
+26 -20
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -30,7 +30,7 @@ class UsesTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -38,9 +38,10 @@ class UsesTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Uses::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Uses(new Fqsen('\DateTime'), new Description('Description'));
@@ -52,10 +53,11 @@ class UsesTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Uses::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Uses(new Fqsen('\DateTime'), new Description('Description'));
@@ -65,9 +67,10 @@ class UsesTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Uses::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Uses(new Fqsen('\DateTime'), new Description('Description'));
@@ -81,7 +84,7 @@ class UsesTest extends TestCase
* @covers ::__construct
* @covers ::getReference
*/
public function testHasReferenceToFqsen(): void
public function testHasReferenceToFqsen() : void
{
$expected = new Fqsen('\DateTime');
@@ -91,11 +94,12 @@ class UsesTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -105,11 +109,12 @@ class UsesTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Uses(new Fqsen('\DateTime'), new Description('Description'));
@@ -117,21 +122,22 @@ class UsesTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Uses::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\FqsenResolver
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Fqsen
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = m::mock(FqsenResolver::class);
$context = new Context('');
$resolver = m::mock(FqsenResolver::class);
$context = new Context('');
$fqsen = new Fqsen('\DateTime');
$fqsen = new Fqsen('\DateTime');
$description = new Description('My Description');
$descriptionFactory
@@ -148,7 +154,7 @@ class UsesTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfBodyIsNotEmpty(): void
public function testFactoryMethodFailsIfBodyIsNotEmpty() : void
{
$this->expectException('InvalidArgumentException');
$this->assertNull(Uses::create(''));
@@ -157,7 +163,7 @@ class UsesTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfResolverIsNull(): void
public function testFactoryMethodFailsIfResolverIsNull() : void
{
$this->expectException('InvalidArgumentException');
Uses::create('body');
@@ -166,7 +172,7 @@ class UsesTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{
$this->expectException('InvalidArgumentException');
Uses::create('body', new FqsenResolver());
+33 -24
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -30,7 +30,7 @@ class VarTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -38,9 +38,10 @@ class VarTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Var_('myVariable', null, new Description('Description'));
@@ -49,9 +50,10 @@ class VarTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__construct
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfVariableNameIsOmmitedIfEmpty(): void
public function testIfVariableNameIsOmmitedIfEmpty() : void
{
$fixture = new Var_('', null, null);
@@ -63,10 +65,11 @@ class VarTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Var_('myVariable', new String_(), new Description('Description'));
$this->assertSame('@var string $myVariable Description', $fixture->render());
@@ -80,9 +83,10 @@ class VarTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__construct
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Var_('myVariable');
@@ -96,7 +100,7 @@ class VarTest extends TestCase
* @covers ::__construct
* @covers ::getVariableName
*/
public function testHasVariableName(): void
public function testHasVariableName() : void
{
$expected = 'myVariable';
@@ -109,7 +113,7 @@ class VarTest extends TestCase
* @covers ::__construct
* @covers ::getType
*/
public function testHasType(): void
public function testHasType() : void
{
$expected = new String_();
@@ -119,11 +123,12 @@ class VarTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -133,12 +138,13 @@ class VarTest extends TestCase
}
/**
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\String_
*
* @covers ::__construct
* @covers ::__toString
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Var_('myVariable', new String_(), new Description('Description'));
@@ -146,17 +152,18 @@ class VarTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$typeResolver = new TypeResolver();
$typeResolver = new TypeResolver();
$descriptionFactory = m::mock(DescriptionFactory::class);
$context = new Context('');
$context = new Context('');
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -170,12 +177,13 @@ class VarTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::<public>
* @uses \phpDocumentor\Reflection\TypeResolver
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
*
* @covers ::create
*/
public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
{
$this->expectException('InvalidArgumentException');
$descriptionFactory = m::mock(DescriptionFactory::class);
@@ -185,17 +193,18 @@ class VarTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodFailsIfResolverIsNull(): void
public function testFactoryMethodFailsIfResolverIsNull() : void
{
$this->expectException('InvalidArgumentException');
Var_::create('body');
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\TypeResolver
*
* @covers ::create
*/
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
{
$this->expectException('InvalidArgumentException');
Var_::create('body', new TypeResolver());
+26 -19
View File
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
@@ -6,8 +8,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<[email protected]>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
@@ -28,7 +28,7 @@ class VersionTest extends TestCase
/**
* Call Mockery::close after each test.
*/
public function tearDown(): void
public function tearDown() : void
{
m::close();
}
@@ -36,9 +36,10 @@ class VersionTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Version::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfCorrectTagNameIsReturned(): void
public function testIfCorrectTagNameIsReturned() : void
{
$fixture = new Version('1.0', new Description('Description'));
@@ -50,10 +51,11 @@ class VersionTest extends TestCase
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Version::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName
*/
public function testIfTagCanBeRenderedUsingDefaultFormatter(): void
public function testIfTagCanBeRenderedUsingDefaultFormatter() : void
{
$fixture = new Version('1.0', new Description('Description'));
@@ -63,9 +65,10 @@ class VersionTest extends TestCase
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Version::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render
*/
public function testIfTagCanBeRenderedUsingSpecificFormatter(): void
public function testIfTagCanBeRenderedUsingSpecificFormatter() : void
{
$fixture = new Version('1.0', new Description('Description'));
@@ -79,7 +82,7 @@ class VersionTest extends TestCase
* @covers ::__construct
* @covers ::getVersion
*/
public function testHasVersionNumber(): void
public function testHasVersionNumber() : void
{
$expected = '1.0';
@@ -89,11 +92,12 @@ class VersionTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testHasDescription(): void
public function testHasDescription() : void
{
$expected = new Description('Description');
@@ -103,11 +107,12 @@ class VersionTest extends TestCase
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Description
*
* @covers ::__construct
* @covers ::__toString
* @uses \phpDocumentor\Reflection\DocBlock\Description
*/
public function testStringRepresentationIsReturned(): void
public function testStringRepresentationIsReturned() : void
{
$fixture = new Version('1.0', new Description('Description'));
@@ -115,18 +120,19 @@ class VersionTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Version::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethod(): void
public function testFactoryMethod() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$context = new Context('');
$context = new Context('');
$version = '1.0';
$version = '1.0';
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -139,13 +145,14 @@ class VersionTest extends TestCase
}
/**
* @covers ::create
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Version::<public>
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
* @uses \phpDocumentor\Reflection\DocBlock\Description
* @uses \phpDocumentor\Reflection\Types\Context
*
* @covers ::create
*/
public function testFactoryMethodCreatesEmptyVersionTag(): void
public function testFactoryMethodCreatesEmptyVersionTag() : void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$descriptionFactory->shouldReceive('create')->never();
@@ -160,7 +167,7 @@ class VersionTest extends TestCase
/**
* @covers ::create
*/
public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex(): void
public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() : void
{
$this->assertNull(Version::create('dkhf<'));
}