mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
add more unit tests and fixed the output
This commit is contained in:
@@ -16,8 +16,11 @@ namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
use Mockery as m;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context;
|
||||
use phpDocumentor\Reflection\Types\Integer;
|
||||
use phpDocumentor\Reflection\Types\String_;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -270,6 +273,128 @@ class ParamTest extends TestCase
|
||||
$this->assertSame($description, $fixture->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testFactoryMethodWithReferenceWithoutType() : void
|
||||
{
|
||||
$typeResolver = new TypeResolver();
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = Param::create(
|
||||
'&$myParameter My Description',
|
||||
$typeResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('&$myParameter My Description', (string) $fixture);
|
||||
$this->assertSame('myParameter', $fixture->getVariableName());
|
||||
$this->assertNull($fixture->getType());
|
||||
$this->assertFalse($fixture->isVariadic());
|
||||
$this->assertTrue($fixture->isReference());
|
||||
$this->assertSame('My Description', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testFactoryMethodWithVariadicReferenceWithoutType() : void
|
||||
{
|
||||
$typeResolver = new TypeResolver();
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = Param::create(
|
||||
'&...$myParameter My Description',
|
||||
$typeResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('&...$myParameter My Description', (string) $fixture);
|
||||
$this->assertSame('myParameter', $fixture->getVariableName());
|
||||
$this->assertNull($fixture->getType());
|
||||
$this->assertTrue($fixture->isVariadic());
|
||||
$this->assertTrue($fixture->isReference());
|
||||
$this->assertSame('My Description', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testFactoryMethodWithoutType() : void
|
||||
{
|
||||
$typeResolver = new TypeResolver();
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = Param::create(
|
||||
'$myParameter My Description',
|
||||
$typeResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('$myParameter My Description', (string) $fixture);
|
||||
$this->assertSame('myParameter', $fixture->getVariableName());
|
||||
$this->assertNull($fixture->getType());
|
||||
$this->assertFalse($fixture->isVariadic());
|
||||
$this->assertFalse($fixture->isReference());
|
||||
$this->assertSame('My Description', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testFactoryMethodWithType() : void
|
||||
{
|
||||
$typeResolver = new TypeResolver();
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = Param::create(
|
||||
'int My Description',
|
||||
$typeResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('int My Description', (string) $fixture);
|
||||
$this->assertSame('', $fixture->getVariableName());
|
||||
$this->assertInstanceOf(Integer::class, $fixture->getType());
|
||||
$this->assertSame('My Description', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::<public>
|
||||
* @uses \phpDocumentor\Reflection\TypeResolver
|
||||
|
||||
@@ -16,8 +16,11 @@ namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
use Mockery as m;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context;
|
||||
use phpDocumentor\Reflection\Types\Integer;
|
||||
use phpDocumentor\Reflection\Types\String_;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -169,6 +172,64 @@ class PropertyReadTest extends TestCase
|
||||
$this->assertSame($description, $fixture->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testFactoryMethodWithoutType() : void
|
||||
{
|
||||
$typeResolver = new TypeResolver();
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = PropertyRead::create(
|
||||
'$myParameter My Description',
|
||||
$typeResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('$myParameter My Description', (string) $fixture);
|
||||
$this->assertSame('myParameter', $fixture->getVariableName());
|
||||
$this->assertNull($fixture->getType());
|
||||
$this->assertSame('My Description', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testFactoryMethodWithType() : void
|
||||
{
|
||||
$typeResolver = new TypeResolver();
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = PropertyRead::create(
|
||||
'int My Description',
|
||||
$typeResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('int My Description', (string) $fixture);
|
||||
$this->assertSame('', $fixture->getVariableName());
|
||||
$this->assertInstanceOf(Integer::class, $fixture->getType());
|
||||
$this->assertSame('My Description', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::<public>
|
||||
* @uses \phpDocumentor\Reflection\TypeResolver
|
||||
|
||||
@@ -16,8 +16,11 @@ namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
use Mockery as m;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context;
|
||||
use phpDocumentor\Reflection\Types\Integer;
|
||||
use phpDocumentor\Reflection\Types\String_;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -164,6 +167,64 @@ class PropertyTest extends TestCase
|
||||
$this->assertSame($description, $fixture->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testFactoryMethodWithoutType() : void
|
||||
{
|
||||
$typeResolver = new TypeResolver();
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = Property::create(
|
||||
'$myParameter My Description',
|
||||
$typeResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('$myParameter My Description', (string) $fixture);
|
||||
$this->assertSame('myParameter', $fixture->getVariableName());
|
||||
$this->assertNull($fixture->getType());
|
||||
$this->assertSame('My Description', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testFactoryMethodWithType() : void
|
||||
{
|
||||
$typeResolver = new TypeResolver();
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = Property::create(
|
||||
'int My Description',
|
||||
$typeResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('int My Description', (string) $fixture);
|
||||
$this->assertSame('', $fixture->getVariableName());
|
||||
$this->assertInstanceOf(Integer::class, $fixture->getType());
|
||||
$this->assertSame('My Description', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::<public>
|
||||
* @uses \phpDocumentor\Reflection\TypeResolver
|
||||
|
||||
@@ -16,8 +16,11 @@ namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
use Mockery as m;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context;
|
||||
use phpDocumentor\Reflection\Types\Integer;
|
||||
use phpDocumentor\Reflection\Types\String_;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -169,6 +172,64 @@ class PropertyWriteTest extends TestCase
|
||||
$this->assertSame($description, $fixture->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testFactoryMethodWithoutType() : void
|
||||
{
|
||||
$typeResolver = new TypeResolver();
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = PropertyWrite::create(
|
||||
'$myParameter My Description',
|
||||
$typeResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('$myParameter My Description', (string) $fixture);
|
||||
$this->assertSame('myParameter', $fixture->getVariableName());
|
||||
$this->assertNull($fixture->getType());
|
||||
$this->assertSame('My Description', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testFactoryMethodWithType() : void
|
||||
{
|
||||
$typeResolver = new TypeResolver();
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = PropertyWrite::create(
|
||||
'int My Description',
|
||||
$typeResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('int My Description', (string) $fixture);
|
||||
$this->assertSame('', $fixture->getVariableName());
|
||||
$this->assertInstanceOf(Integer::class, $fixture->getType());
|
||||
$this->assertSame('My Description', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::<public>
|
||||
* @uses \phpDocumentor\Reflection\TypeResolver
|
||||
|
||||
@@ -16,8 +16,11 @@ namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
use Mockery as m;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use phpDocumentor\Reflection\TypeResolver;
|
||||
use phpDocumentor\Reflection\Types\Context;
|
||||
use phpDocumentor\Reflection\Types\Integer;
|
||||
use phpDocumentor\Reflection\Types\String_;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -176,6 +179,64 @@ class VarTest extends TestCase
|
||||
$this->assertSame($description, $fixture->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testFactoryMethodWithoutType() : void
|
||||
{
|
||||
$typeResolver = new TypeResolver();
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = Var_::create(
|
||||
'$myParameter My Description',
|
||||
$typeResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('$myParameter My Description', (string) $fixture);
|
||||
$this->assertSame('myParameter', $fixture->getVariableName());
|
||||
$this->assertNull($fixture->getType());
|
||||
$this->assertSame('My Description', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testFactoryMethodWithType() : void
|
||||
{
|
||||
$typeResolver = new TypeResolver();
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = Var_::create(
|
||||
'int My Description',
|
||||
$typeResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('int My Description', (string) $fixture);
|
||||
$this->assertSame('', $fixture->getVariableName());
|
||||
$this->assertInstanceOf(Integer::class, $fixture->getType());
|
||||
$this->assertSame('My Description', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::<public>
|
||||
* @uses \phpDocumentor\Reflection\TypeResolver
|
||||
|
||||
Reference in New Issue
Block a user