apply coding standard to code

This commit is contained in:
TomasVotruba
2018-01-02 13:40:57 +01:00
parent 89a0935960
commit 1c8f795c0e
45 changed files with 212 additions and 216 deletions
@@ -43,7 +43,7 @@ class DescriptionFactoryTest extends TestCase
$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());
@@ -60,7 +60,7 @@ class DescriptionFactoryTest extends TestCase
$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());
@@ -77,15 +77,15 @@ class DescriptionFactoryTest extends TestCase
*/
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')));
$factory = new DescriptionFactory($tagFactory);
$factory = new DescriptionFactory($tagFactory);
$description = $factory->create($contents, $context);
$this->assertSame($contents, $description->render());
@@ -102,15 +102,15 @@ class DescriptionFactoryTest extends TestCase
*/
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')));
$factory = new DescriptionFactory($tagFactory);
$factory = new DescriptionFactory($tagFactory);
$description = $factory->create($contents, $context);
$this->assertSame($contents, $description->render());
@@ -123,7 +123,7 @@ class DescriptionFactoryTest extends TestCase
*/
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
+2 -2
View File
@@ -71,7 +71,7 @@ class DescriptionTest extends TestCase
$fixture = new Description($body, $tags);
$this->assertSame($expected, (string)$fixture);
$this->assertSame($expected, (string) $fixture);
}
/**
@@ -123,6 +123,6 @@ class DescriptionTest extends TestCase
$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);
$this->assertSame($expected, (string) $fixture);
}
}
+4 -4
View File
@@ -58,7 +58,7 @@ DOCCOMMENT;
'This is a summary',
new Description('This is a description'),
[
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag'))
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')),
]
);
@@ -92,7 +92,7 @@ DOCCOMMENT;
'This is a summary',
new Description('This is a description'),
[
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag'))
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')),
]
);
@@ -126,7 +126,7 @@ DOCCOMMENT;
'This is a summary',
new Description('This is a description'),
[
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag'))
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')),
]
);
@@ -166,7 +166,7 @@ DOCCOMMENT;
'This is a summary',
new Description('This is a description'),
[
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag'))
new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')),
]
);
+18 -19
View File
@@ -32,7 +32,6 @@ use PHPUnit\Framework\TestCase;
*/
class StandardTagFactoryTest extends TestCase
{
/**
* Call Mockery::close after each test.
*/
@@ -51,10 +50,10 @@ class StandardTagFactoryTest extends TestCase
*/
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
@@ -83,7 +82,7 @@ class StandardTagFactoryTest extends TestCase
*/
public function testCreatingASpecificTag(): void
{
$context = new Context('');
$context = new Context('');
$tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class));
/** @var Author $tag */
@@ -104,8 +103,8 @@ class StandardTagFactoryTest extends TestCase
*/
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))
@@ -120,7 +119,7 @@ class StandardTagFactoryTest extends TestCase
$tag = $tagFactory->create('@see Tag');
$this->assertInstanceOf(See::class, $tag);
$this->assertSame($fqsen, (string)$tag->getReference());
$this->assertSame($fqsen, (string) $tag->getReference());
}
/**
@@ -132,7 +131,7 @@ class StandardTagFactoryTest extends TestCase
*/
public function testPassingYourOwnSetOfTagHandlers(): void
{
$context = new Context('');
$context = new Context('');
$tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class), ['user' => Author::class]);
/** @var Author $tag */
@@ -162,7 +161,7 @@ class StandardTagFactoryTest extends TestCase
*/
public function testAddParameterToServiceLocator(): void
{
$resolver = m::mock(FqsenResolver::class);
$resolver = m::mock(FqsenResolver::class);
$tagFactory = new StandardTagFactory($resolver);
$tagFactory->addParameter('myParam', 'myValue');
@@ -181,7 +180,7 @@ class StandardTagFactoryTest extends TestCase
{
$service = new PassthroughFormatter();
$resolver = m::mock(FqsenResolver::class);
$resolver = m::mock(FqsenResolver::class);
$tagFactory = new StandardTagFactory($resolver);
$tagFactory->addService($service);
@@ -199,9 +198,9 @@ class StandardTagFactoryTest extends TestCase
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);
@@ -221,7 +220,7 @@ class StandardTagFactoryTest extends TestCase
*/
public function testRegisteringAHandlerForANewTag(): void
{
$resolver = m::mock(FqsenResolver::class);
$resolver = m::mock(FqsenResolver::class);
$tagFactory = new StandardTagFactory($resolver);
$tagFactory->registerTagHandler('my-tag', Author::class);
@@ -239,7 +238,7 @@ class StandardTagFactoryTest extends TestCase
public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified(): void
{
$this->expectException('InvalidArgumentException');
$resolver = m::mock(FqsenResolver::class);
$resolver = m::mock(FqsenResolver::class);
$tagFactory = new StandardTagFactory($resolver);
$tagFactory->registerTagHandler(\Name\Spaced\Tag::class, Author::class);
}
@@ -252,7 +251,7 @@ class StandardTagFactoryTest extends TestCase
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', '');
}
@@ -265,7 +264,7 @@ class StandardTagFactoryTest extends TestCase
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');
}
@@ -278,7 +277,7 @@ class StandardTagFactoryTest extends TestCase
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');
}
@@ -293,7 +292,7 @@ class StandardTagFactoryTest extends TestCase
*/
public function testReturntagIsMappedCorrectly(): void
{
$context = new Context('');
$context = new Context('');
$descriptionFactory = m::mock(DescriptionFactory::class);
$descriptionFactory
+2 -3
View File
@@ -27,7 +27,6 @@ use PHPUnit\Framework\TestCase;
*/
class CoversTest extends TestCase
{
/**
* Call Mockery::close after each test.
*/
@@ -114,7 +113,7 @@ class CoversTest extends TestCase
{
$fixture = new Covers(new Fqsen('\DateTime'), new Description('Description'));
$this->assertSame('\DateTime Description', (string)$fixture);
$this->assertSame('\DateTime Description', (string) $fixture);
}
/**
@@ -141,7 +140,7 @@ class CoversTest extends TestCase
$fixture = Covers::create('DateTime My Description', $descriptionFactory, $resolver, $context);
$this->assertSame('\DateTime My Description', (string)$fixture);
$this->assertSame('\DateTime My Description', (string) $fixture);
$this->assertSame($fqsen, $fixture->getReference());
$this->assertSame($description, $fixture->getDescription());
}
+2 -2
View File
@@ -111,7 +111,7 @@ class DeprecatedTest extends TestCase
{
$fixture = new Deprecated('1.0', new Description('Description'));
$this->assertSame('1.0 Description', (string)$fixture);
$this->assertSame('1.0 Description', (string) $fixture);
}
/**
@@ -133,7 +133,7 @@ class DeprecatedTest extends TestCase
$fixture = Deprecated::create('1.0 My Description', $descriptionFactory, $context);
$this->assertSame('1.0 My Description', (string)$fixture);
$this->assertSame('1.0 My Description', (string) $fixture);
$this->assertSame($version, $fixture->getVersion());
$this->assertSame($description, $fixture->getDescription());
}
-1
View File
@@ -11,7 +11,6 @@ use PHPUnit\Framework\TestCase;
*/
class ExampleTest extends TestCase
{
/**
* Call Mockery::close after each test.
*/
@@ -50,14 +50,14 @@ class AlignFormatterTest extends TestCase
$tags = [
new Param('foobar', new String_()),
new Version('1.2.0'),
new Link('http://www.example.com', new Description('Examples'))
new Link('http://www.example.com', new Description('Examples')),
];
$fixture = new AlignFormatter($tags);
$expected = [
'@param string $foobar',
'@version 1.2.0',
'@link http://www.example.com Examples'
'@link http://www.example.com Examples',
];
foreach ($tags as $key => $tag) {
+3 -2
View File
@@ -32,6 +32,7 @@ class GenericTest extends TestCase
{
m::close();
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic::__construct
* @uses \phpDocumentor\Reflection\DocBlock\Description
@@ -98,7 +99,7 @@ class GenericTest extends TestCase
{
$fixture = new Generic('generic', new Description('Description'));
$this->assertSame('Description', (string)$fixture);
$this->assertSame('Description', (string) $fixture);
}
/**
@@ -120,7 +121,7 @@ class GenericTest extends TestCase
$fixture = Generic::create('My Description', 'generic', $descriptionFactory, $context);
$this->assertSame('My Description', (string)$fixture);
$this->assertSame('My Description', (string) $fixture);
$this->assertSame($generics, $fixture->getName());
$this->assertSame($description, $fixture->getDescription());
}
+3 -3
View File
@@ -111,7 +111,7 @@ class LinkTest extends TestCase
{
$fixture = new Link('http://this.is.my/link', new Description('Description'));
$this->assertSame('http://this.is.my/link Description', (string)$fixture);
$this->assertSame('http://this.is.my/link Description', (string) $fixture);
}
/**
@@ -133,7 +133,7 @@ class LinkTest extends TestCase
$fixture = Link::create('http://this.is.my/link My Description', $descriptionFactory, $context);
$this->assertSame('http://this.is.my/link My Description', (string)$fixture);
$this->assertSame('http://this.is.my/link My Description', (string) $fixture);
$this->assertSame($links, $fixture->getLink());
$this->assertSame($description, $fixture->getDescription());
}
@@ -152,7 +152,7 @@ class LinkTest extends TestCase
$fixture = Link::create('', $descriptionFactory, new Context(''));
$this->assertSame('', (string)$fixture);
$this->assertSame('', (string) $fixture);
$this->assertSame('', $fixture->getLink());
$this->assertSame(null, $fixture->getDescription());
}
+45 -46
View File
@@ -66,7 +66,7 @@ class MethodTest extends TestCase
{
$arguments = [
['name' => 'argument1', 'type' => new String_()],
['name' => 'argument2', 'type' => new Object_()]
['name' => 'argument2', 'type' => new Object_()],
];
$fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description'));
@@ -111,7 +111,7 @@ class MethodTest extends TestCase
public function testHasArguments(): void
{
$arguments = [
[ 'name' => 'argument1', 'type' => new String_() ]
['name' => 'argument1', 'type' => new String_()],
];
$fixture = new Method('myMethod', $arguments);
@@ -127,7 +127,7 @@ class MethodTest extends TestCase
{
$arguments = ['argument1'];
$expected = [
[ 'name' => $arguments[0], 'type' => new Void_() ]
['name' => $arguments[0], 'type' => new Void_()],
];
$fixture = new Method('myMethod', $arguments);
@@ -141,9 +141,9 @@ class MethodTest extends TestCase
*/
public function testArgumentTypeCanBeInferredAsVoid(): void
{
$arguments = [ [ 'name' => 'argument1' ] ];
$arguments = [['name' => 'argument1']];
$expected = [
[ 'name' => $arguments[0]['name'], 'type' => new Void_() ]
['name' => $arguments[0]['name'], 'type' => new Void_()],
];
$fixture = new Method('myMethod', $arguments);
@@ -160,15 +160,15 @@ class MethodTest extends TestCase
public function testRestArgumentIsParsedAsRegularArg(): void
{
$expected = [
[ 'name' => 'arg1', 'type' => new Void_() ],
[ 'name' => 'rest', 'type' => new Void_() ],
[ 'name' => 'rest2', 'type' => new Array_() ],
['name' => 'arg1', 'type' => new Void_()],
['name' => 'rest', 'type' => new Void_()],
['name' => 'rest2', 'type' => new Array_()],
];
$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(
@@ -244,13 +244,13 @@ class MethodTest extends TestCase
{
$arguments = [
['name' => 'argument1', 'type' => new String_()],
['name' => 'argument2', 'type' => new Object_()]
['name' => 'argument2', 'type' => new Object_()],
];
$fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description'));
$this->assertSame(
'static void myMethod(string $argument1, object $argument2) My Description',
(string)$fixture
(string) $fixture
);
}
@@ -266,13 +266,13 @@ class MethodTest extends TestCase
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_() ]
['name' => 'argument1', 'type' => new String_()],
['name' => 'argument2', 'type' => new Void_()],
];
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -284,7 +284,7 @@ class MethodTest extends TestCase
$context
);
$this->assertSame('static void myMethod(string $argument1, void $argument2) My Description', (string)$fixture);
$this->assertSame('static void myMethod(string $argument1, void $argument2) My Description', (string) $fixture);
$this->assertSame('myMethod', $fixture->getMethodName());
$this->assertEquals($expectedArguments, $fixture->getArguments());
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
@@ -301,10 +301,10 @@ class MethodTest extends TestCase
public function testReturnTypeThis(): void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = new TypeResolver();
$context = new Context('');
$resolver = new TypeResolver();
$context = new Context('');
$description = new Description('');
$description = new Description('');
$descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description);
@@ -316,7 +316,7 @@ class MethodTest extends TestCase
);
$this->assertTrue($fixture->isStatic());
$this->assertSame('static $this myMethod()', (string)$fixture);
$this->assertSame('static $this myMethod()', (string) $fixture);
$this->assertSame('myMethod', $fixture->getMethodName());
$this->assertInstanceOf(This::class, $fixture->getReturnType());
}
@@ -334,15 +334,14 @@ class MethodTest extends TestCase
/**
* @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_
* @param string null $expectedKeyType
* @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,
@@ -350,11 +349,11 @@ class MethodTest extends TestCase
?string $expectedValueType = null,
?string $expectedKeyType = null
): void {
$resolver = new TypeResolver();
$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);
@@ -433,7 +432,7 @@ class MethodTest extends TestCase
public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void
{
$this->expectException('InvalidArgumentException');
new Method('body', [ [ 'name' => 'myName', 'unknown' => 'nah' ] ]);
new Method('body', [['name' => 'myName', 'unknown' => 'nah']]);
}
/**
@@ -448,10 +447,10 @@ class MethodTest extends TestCase
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');
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
@@ -462,7 +461,7 @@ class MethodTest extends TestCase
$context
);
$this->assertSame('static void myMethod() My Description', (string)$fixture);
$this->assertSame('static void myMethod() My Description', (string) $fixture);
$this->assertSame('myMethod', $fixture->getMethodName());
$this->assertEquals([], $fixture->getArguments());
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
@@ -482,10 +481,10 @@ class MethodTest extends TestCase
public function testCreateWithoutReturnType(): void
{
$descriptionFactory = m::mock(DescriptionFactory::class);
$resolver = new TypeResolver();
$context = new Context('');
$resolver = new TypeResolver();
$context = new Context('');
$description = new Description('');
$description = new Description('');
$descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description);
@@ -496,7 +495,7 @@ class MethodTest extends TestCase
$context
);
$this->assertSame('void myMethod()', (string)$fixture);
$this->assertSame('void myMethod()', (string) $fixture);
$this->assertSame('myMethod', $fixture->getMethodName());
$this->assertEquals([], $fixture->getArguments());
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
@@ -519,8 +518,8 @@ class MethodTest extends TestCase
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(''));
@@ -531,7 +530,7 @@ class MethodTest extends TestCase
$context
);
$this->assertSame('\MyClass[]|int[] myMethod()', (string)$fixture);
$this->assertSame('\MyClass[]|int[] myMethod()', (string) $fixture);
$this->assertSame('myMethod', $fixture->getMethodName());
$this->assertEquals([], $fixture->getArguments());
+2 -2
View File
@@ -149,7 +149,7 @@ class ParamTest extends TestCase
{
$fixture = new Param('myParameter', new String_(), true, new Description('Description'));
$this->assertSame('string ...$myParameter Description', (string)$fixture);
$this->assertSame('string ...$myParameter Description', (string) $fixture);
}
/**
@@ -170,7 +170,7 @@ class ParamTest extends TestCase
$fixture = Param::create('string ...$myParameter My Description', $typeResolver, $descriptionFactory, $context);
$this->assertSame('string ...$myParameter My Description', (string)$fixture);
$this->assertSame('string ...$myParameter My Description', (string) $fixture);
$this->assertSame('myParameter', $fixture->getVariableName());
$this->assertInstanceOf(String_::class, $fixture->getType());
$this->assertTrue($fixture->isVariadic());
@@ -131,7 +131,7 @@ class PropertyReadTest extends TestCase
{
$fixture = new PropertyRead('myProperty', new String_(), new Description('Description'));
$this->assertSame('string $myProperty Description', (string)$fixture);
$this->assertSame('string $myProperty Description', (string) $fixture);
}
/**
@@ -157,7 +157,7 @@ class PropertyReadTest extends TestCase
$context
);
$this->assertSame('string $myProperty My Description', (string)$fixture);
$this->assertSame('string $myProperty My Description', (string) $fixture);
$this->assertSame('myProperty', $fixture->getVariableName());
$this->assertInstanceOf(String_::class, $fixture->getType());
$this->assertSame($description, $fixture->getDescription());
+2 -2
View File
@@ -131,7 +131,7 @@ class PropertyTest extends TestCase
{
$fixture = new Property('myProperty', new String_(), new Description('Description'));
$this->assertSame('string $myProperty Description', (string)$fixture);
$this->assertSame('string $myProperty Description', (string) $fixture);
}
/**
@@ -152,7 +152,7 @@ class PropertyTest extends TestCase
$fixture = Property::create('string $myProperty My Description', $typeResolver, $descriptionFactory, $context);
$this->assertSame('string $myProperty My Description', (string)$fixture);
$this->assertSame('string $myProperty My Description', (string) $fixture);
$this->assertSame('myProperty', $fixture->getVariableName());
$this->assertInstanceOf(String_::class, $fixture->getType());
$this->assertSame($description, $fixture->getDescription());
@@ -131,7 +131,7 @@ class PropertyWriteTest extends TestCase
{
$fixture = new PropertyWrite('myProperty', new String_(), new Description('Description'));
$this->assertSame('string $myProperty Description', (string)$fixture);
$this->assertSame('string $myProperty Description', (string) $fixture);
}
/**
@@ -157,7 +157,7 @@ class PropertyWriteTest extends TestCase
$context
);
$this->assertSame('string $myProperty My Description', (string)$fixture);
$this->assertSame('string $myProperty My Description', (string) $fixture);
$this->assertSame('myProperty', $fixture->getVariableName());
$this->assertInstanceOf(String_::class, $fixture->getType());
$this->assertSame($description, $fixture->getDescription());
+2 -2
View File
@@ -113,7 +113,7 @@ class ReturnTest extends TestCase
{
$fixture = new Return_(new String_(), new Description('Description'));
$this->assertSame('string Description', (string)$fixture);
$this->assertSame('string Description', (string) $fixture);
}
/**
@@ -137,7 +137,7 @@ class ReturnTest extends TestCase
$fixture = Return_::create('string My Description', $resolver, $descriptionFactory, $context);
$this->assertSame('string My Description', (string)$fixture);
$this->assertSame('string My Description', (string) $fixture);
$this->assertEquals($type, $fixture->getType());
$this->assertSame($description, $fixture->getDescription());
}
+5 -5
View File
@@ -126,7 +126,7 @@ class SeeTest extends TestCase
{
$fixture = new See(new FqsenRef(new Fqsen('\DateTime::format()')), new Description('Description'));
$this->assertSame('\DateTime::format() Description', (string)$fixture);
$this->assertSame('\DateTime::format() Description', (string) $fixture);
}
/**
@@ -154,9 +154,9 @@ class SeeTest extends TestCase
$fixture = See::create('DateTime My Description', $resolver, $descriptionFactory, $context);
$this->assertSame('\DateTime My Description', (string)$fixture);
$this->assertSame('\DateTime My Description', (string) $fixture);
$this->assertInstanceOf(FqsenRef::class, $fixture->getReference());
$this->assertSame((string)$fqsen, (string)$fixture->getReference());
$this->assertSame((string) $fqsen, (string) $fixture->getReference());
$this->assertSame($description, $fixture->getDescription());
}
@@ -184,9 +184,9 @@ class SeeTest extends TestCase
$fixture = See::create('https://test.org My Description', $resolver, $descriptionFactory, $context);
$this->assertSame('https://test.org My Description', (string)$fixture);
$this->assertSame('https://test.org My Description', (string) $fixture);
$this->assertInstanceOf(UrlRef::class, $fixture->getReference());
$this->assertSame('https://test.org', (string)$fixture->getReference());
$this->assertSame('https://test.org', (string) $fixture->getReference());
$this->assertSame($description, $fixture->getDescription());
}
+5 -6
View File
@@ -25,7 +25,6 @@ use PHPUnit\Framework\TestCase;
*/
class SinceTest extends TestCase
{
/**
* Call Mockery::close after each test.
*/
@@ -112,7 +111,7 @@ class SinceTest extends TestCase
{
$fixture = new Since('1.0', new Description('Description'));
$this->assertSame('1.0 Description', (string)$fixture);
$this->assertSame('1.0 Description', (string) $fixture);
}
/**
@@ -125,16 +124,16 @@ class SinceTest extends TestCase
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);
$fixture = Since::create('1.0 My Description', $descriptionFactory, $context);
$this->assertSame('1.0 My Description', (string)$fixture);
$this->assertSame('1.0 My Description', (string) $fixture);
$this->assertSame($version, $fixture->getVersion());
$this->assertSame($description, $fixture->getDescription());
}
@@ -153,7 +152,7 @@ class SinceTest extends TestCase
$fixture = Since::create('', $descriptionFactory, new Context(''));
$this->assertSame('', (string)$fixture);
$this->assertSame('', (string) $fixture);
$this->assertSame(null, $fixture->getVersion());
$this->assertSame(null, $fixture->getDescription());
}
+3 -3
View File
@@ -129,7 +129,7 @@ class SourceTest extends TestCase
{
$fixture = new Source(1, 10, new Description('Description'));
$this->assertSame('1 10 Description', (string)$fixture);
$this->assertSame('1 10 Description', (string) $fixture);
}
/**
@@ -142,14 +142,14 @@ class SourceTest extends TestCase
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);
$fixture = Source::create('1 10 My Description', $descriptionFactory, $context);
$this->assertSame('1 10 My Description', (string)$fixture);
$this->assertSame('1 10 My Description', (string) $fixture);
$this->assertSame(1, $fixture->getStartingLine());
$this->assertSame(10, $fixture->getLineCount());
$this->assertSame($description, $fixture->getDescription());
+5 -5
View File
@@ -113,7 +113,7 @@ class ThrowsTest extends TestCase
{
$fixture = new Throws(new String_(), new Description('Description'));
$this->assertSame('string Description', (string)$fixture);
$this->assertSame('string Description', (string) $fixture);
}
/**
@@ -128,16 +128,16 @@ class ThrowsTest extends TestCase
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);
$fixture = Throws::create('string My Description', $resolver, $descriptionFactory, $context);
$this->assertSame('string My Description', (string)$fixture);
$this->assertSame('string My Description', (string) $fixture);
$this->assertEquals($type, $fixture->getType());
$this->assertSame($description, $fixture->getDescription());
}
+5 -5
View File
@@ -113,7 +113,7 @@ class UsesTest extends TestCase
{
$fixture = new Uses(new Fqsen('\DateTime'), new Description('Description'));
$this->assertSame('\DateTime Description', (string)$fixture);
$this->assertSame('\DateTime Description', (string) $fixture);
}
/**
@@ -128,10 +128,10 @@ class UsesTest extends TestCase
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
@@ -140,7 +140,7 @@ class UsesTest extends TestCase
$fixture = Uses::create('DateTime My Description', $resolver, $descriptionFactory, $context);
$this->assertSame('\DateTime My Description', (string)$fixture);
$this->assertSame('\DateTime My Description', (string) $fixture);
$this->assertSame($fqsen, $fixture->getReference());
$this->assertSame($description, $fixture->getDescription());
}
+4 -4
View File
@@ -142,7 +142,7 @@ class VarTest extends TestCase
{
$fixture = new Var_('myVariable', new String_(), new Description('Description'));
$this->assertSame('string $myVariable Description', (string)$fixture);
$this->assertSame('string $myVariable Description', (string) $fixture);
}
/**
@@ -154,16 +154,16 @@ class VarTest extends TestCase
*/
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);
$fixture = Var_::create('string $myVariable My Description', $typeResolver, $descriptionFactory, $context);
$this->assertSame('string $myVariable My Description', (string)$fixture);
$this->assertSame('string $myVariable My Description', (string) $fixture);
$this->assertSame('myVariable', $fixture->getVariableName());
$this->assertInstanceOf(String_::class, $fixture->getType());
$this->assertSame($description, $fixture->getDescription());
+5 -5
View File
@@ -111,7 +111,7 @@ class VersionTest extends TestCase
{
$fixture = new Version('1.0', new Description('Description'));
$this->assertSame('1.0 Description', (string)$fixture);
$this->assertSame('1.0 Description', (string) $fixture);
}
/**
@@ -124,16 +124,16 @@ class VersionTest extends TestCase
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);
$fixture = Version::create('1.0 My Description', $descriptionFactory, $context);
$this->assertSame('1.0 My Description', (string)$fixture);
$this->assertSame('1.0 My Description', (string) $fixture);
$this->assertSame($version, $fixture->getVersion());
$this->assertSame($description, $fixture->getDescription());
}
@@ -152,7 +152,7 @@ class VersionTest extends TestCase
$fixture = Version::create('', $descriptionFactory, new Context(''));
$this->assertSame('', (string)$fixture);
$this->assertSame('', (string) $fixture);
$this->assertSame(null, $fixture->getVersion());
$this->assertSame(null, $fixture->getDescription());
}