mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
remove tests and validation that are now covered by typehints
This commit is contained in:
committed by
Jaap van Otterdijk
parent
76b771c23e
commit
193731a153
+1
-3
@@ -102,10 +102,8 @@ final class DocBlock
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current location.
|
* Returns the current location.
|
||||||
*
|
|
||||||
* @return Location
|
|
||||||
*/
|
*/
|
||||||
public function getLocation(): Location
|
public function getLocation(): ?Location
|
||||||
{
|
{
|
||||||
return $this->location;
|
return $this->location;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ final class Author extends BaseTag implements Factory\StaticMethod
|
|||||||
*/
|
*/
|
||||||
public function __construct(string $authorName, string $authorEmail)
|
public function __construct(string $authorName, string $authorEmail)
|
||||||
{
|
{
|
||||||
Assert::string($authorName);
|
|
||||||
Assert::string($authorEmail);
|
|
||||||
if ($authorEmail && !filter_var($authorEmail, FILTER_VALIDATE_EMAIL)) {
|
if ($authorEmail && !filter_var($authorEmail, FILTER_VALIDATE_EMAIL)) {
|
||||||
throw new \InvalidArgumentException('The author tag does not have a valid e-mail address');
|
throw new \InvalidArgumentException('The author tag does not have a valid e-mail address');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ final class Covers extends BaseTag implements Factory\StaticMethod
|
|||||||
FqsenResolver $resolver = null,
|
FqsenResolver $resolver = null,
|
||||||
TypeContext $context = null
|
TypeContext $context = null
|
||||||
) {
|
) {
|
||||||
Assert::string($body);
|
|
||||||
Assert::notEmpty($body);
|
Assert::notEmpty($body);
|
||||||
|
|
||||||
$parts = preg_split('/\s+/Su', $body, 2);
|
$parts = preg_split('/\s+/Su', $body, 2);
|
||||||
|
|||||||
@@ -56,11 +56,10 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod
|
|||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create(
|
public static function create(
|
||||||
string $body,
|
?string $body,
|
||||||
DescriptionFactory $descriptionFactory = null,
|
DescriptionFactory $descriptionFactory = null,
|
||||||
TypeContext $context = null
|
TypeContext $context = null
|
||||||
) {
|
) {
|
||||||
Assert::nullOrString($body);
|
|
||||||
if (empty($body)) {
|
if (empty($body)) {
|
||||||
return new static();
|
return new static();
|
||||||
}
|
}
|
||||||
@@ -82,17 +81,15 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod
|
|||||||
/**
|
/**
|
||||||
* Gets the version section of the tag.
|
* Gets the version section of the tag.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getVersion(): string
|
public function getVersion()
|
||||||
{
|
{
|
||||||
return $this->version;
|
return $this->version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string representation for this tag.
|
* Returns a string representation for this tag.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function __toString(): string
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ class Generic extends BaseTag implements Factory\StaticMethod
|
|||||||
DescriptionFactory $descriptionFactory = null,
|
DescriptionFactory $descriptionFactory = null,
|
||||||
TypeContext $context = null
|
TypeContext $context = null
|
||||||
) {
|
) {
|
||||||
Assert::string($body);
|
|
||||||
Assert::stringNotEmpty($name);
|
Assert::stringNotEmpty($name);
|
||||||
Assert::notNull($descriptionFactory);
|
Assert::notNull($descriptionFactory);
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ final class Link extends BaseTag implements Factory\StaticMethod
|
|||||||
*/
|
*/
|
||||||
public static function create(string $body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null)
|
public static function create(string $body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null)
|
||||||
{
|
{
|
||||||
Assert::string($body);
|
|
||||||
Assert::notNull($descriptionFactory);
|
Assert::notNull($descriptionFactory);
|
||||||
|
|
||||||
$parts = preg_split('/\s+/Su', $body, 2);
|
$parts = preg_split('/\s+/Su', $body, 2);
|
||||||
|
|||||||
@@ -44,9 +44,6 @@ final class Param extends BaseTag implements Factory\StaticMethod
|
|||||||
*/
|
*/
|
||||||
public function __construct(string $variableName, Type $type = null, bool $isVariadic = false, Description $description = null)
|
public function __construct(string $variableName, Type $type = null, bool $isVariadic = false, Description $description = null)
|
||||||
{
|
{
|
||||||
Assert::string($variableName);
|
|
||||||
Assert::boolean($isVariadic);
|
|
||||||
|
|
||||||
$this->variableName = $variableName;
|
$this->variableName = $variableName;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->isVariadic = $isVariadic;
|
$this->isVariadic = $isVariadic;
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ class Property extends BaseTag implements Factory\StaticMethod
|
|||||||
*/
|
*/
|
||||||
public function __construct(string $variableName, Type $type = null, Description $description = null)
|
public function __construct(string $variableName, Type $type = null, Description $description = null)
|
||||||
{
|
{
|
||||||
Assert::string($variableName);
|
|
||||||
|
|
||||||
$this->variableName = $variableName;
|
$this->variableName = $variableName;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod
|
|||||||
*/
|
*/
|
||||||
public function __construct(string $variableName, Type $type = null, Description $description = null)
|
public function __construct(string $variableName, Type $type = null, Description $description = null)
|
||||||
{
|
{
|
||||||
Assert::string($variableName);
|
|
||||||
|
|
||||||
$this->variableName = $variableName;
|
$this->variableName = $variableName;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod
|
|||||||
*/
|
*/
|
||||||
public function __construct(string $variableName, Type $type = null, Description $description = null)
|
public function __construct(string $variableName, Type $type = null, Description $description = null)
|
||||||
{
|
{
|
||||||
Assert::string($variableName);
|
|
||||||
|
|
||||||
$this->variableName = $variableName;
|
$this->variableName = $variableName;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ final class Return_ extends BaseTag implements Factory\StaticMethod
|
|||||||
DescriptionFactory $descriptionFactory = null,
|
DescriptionFactory $descriptionFactory = null,
|
||||||
TypeContext $context = null
|
TypeContext $context = null
|
||||||
) {
|
) {
|
||||||
Assert::string($body);
|
|
||||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||||
|
|
||||||
$parts = preg_split('/\s+/Su', $body, 2);
|
$parts = preg_split('/\s+/Su', $body, 2);
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ class See extends BaseTag implements Factory\StaticMethod
|
|||||||
DescriptionFactory $descriptionFactory = null,
|
DescriptionFactory $descriptionFactory = null,
|
||||||
TypeContext $context = null
|
TypeContext $context = null
|
||||||
) {
|
) {
|
||||||
Assert::string($body);
|
|
||||||
Assert::allNotNull([$resolver, $descriptionFactory]);
|
Assert::allNotNull([$resolver, $descriptionFactory]);
|
||||||
|
|
||||||
$parts = preg_split('/\s+/Su', $body, 2);
|
$parts = preg_split('/\s+/Su', $body, 2);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ final class Since extends BaseTag implements Factory\StaticMethod
|
|||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create(
|
public static function create(
|
||||||
string $body,
|
?string $body,
|
||||||
DescriptionFactory $descriptionFactory = null,
|
DescriptionFactory $descriptionFactory = null,
|
||||||
TypeContext $context = null
|
TypeContext $context = null
|
||||||
) {
|
) {
|
||||||
@@ -78,10 +78,8 @@ final class Since extends BaseTag implements Factory\StaticMethod
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the version section of the tag.
|
* Gets the version section of the tag.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getVersion(): string
|
public function getVersion(): ?string
|
||||||
{
|
{
|
||||||
return $this->version;
|
return $this->version;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ final class Throws extends BaseTag implements Factory\StaticMethod
|
|||||||
DescriptionFactory $descriptionFactory = null,
|
DescriptionFactory $descriptionFactory = null,
|
||||||
TypeContext $context = null
|
TypeContext $context = null
|
||||||
) {
|
) {
|
||||||
Assert::string($body);
|
|
||||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||||
|
|
||||||
$parts = preg_split('/\s+/Su', $body, 2);
|
$parts = preg_split('/\s+/Su', $body, 2);
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ final class Uses extends BaseTag implements Factory\StaticMethod
|
|||||||
DescriptionFactory $descriptionFactory = null,
|
DescriptionFactory $descriptionFactory = null,
|
||||||
TypeContext $context = null
|
TypeContext $context = null
|
||||||
) {
|
) {
|
||||||
Assert::string($body);
|
|
||||||
Assert::allNotNull([$resolver, $descriptionFactory]);
|
Assert::allNotNull([$resolver, $descriptionFactory]);
|
||||||
|
|
||||||
$parts = preg_split('/\s+/Su', $body, 2);
|
$parts = preg_split('/\s+/Su', $body, 2);
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ class Var_ extends BaseTag implements Factory\StaticMethod
|
|||||||
*/
|
*/
|
||||||
public function __construct(string $variableName, Type $type = null, Description $description = null)
|
public function __construct(string $variableName, Type $type = null, Description $description = null)
|
||||||
{
|
{
|
||||||
Assert::string($variableName);
|
|
||||||
|
|
||||||
$this->variableName = $variableName;
|
$this->variableName = $variableName;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->description = $description;
|
$this->description = $description;
|
||||||
|
|||||||
@@ -56,11 +56,10 @@ final class Version extends BaseTag implements Factory\StaticMethod
|
|||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function create(
|
public static function create(
|
||||||
string $body,
|
?string $body,
|
||||||
DescriptionFactory $descriptionFactory = null,
|
DescriptionFactory $descriptionFactory = null,
|
||||||
TypeContext $context = null
|
TypeContext $context = null
|
||||||
) {
|
) {
|
||||||
Assert::nullOrString($body);
|
|
||||||
if (empty($body)) {
|
if (empty($body)) {
|
||||||
return new static();
|
return new static();
|
||||||
}
|
}
|
||||||
@@ -78,10 +77,8 @@ final class Version extends BaseTag implements Factory\StaticMethod
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the version section of the tag.
|
* Gets the version section of the tag.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getVersion(): string
|
public function getVersion(): ?string
|
||||||
{
|
{
|
||||||
return $this->version;
|
return $this->version;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$parts = $this->splitDocBlock($this->stripDocComment($docblock));
|
$parts = $this->splitDocBlock($this->stripDocComment($docblock));
|
||||||
list($templateMarker, $summary, $description, $tags) = $parts;
|
[$templateMarker, $summary, $description, $tags] = $parts;
|
||||||
|
|
||||||
return new DocBlock(
|
return new DocBlock(
|
||||||
$summary,
|
$summary,
|
||||||
@@ -218,7 +218,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
|||||||
*
|
*
|
||||||
* @return DocBlock\Tag[]
|
* @return DocBlock\Tag[]
|
||||||
*/
|
*/
|
||||||
private function parseTagBlock(string $tags, Types\Context $context)
|
private function parseTagBlock(string $tags, Types\Context $context): array
|
||||||
{
|
{
|
||||||
$tags = $this->filterTagBlock($tags);
|
$tags = $this->filterTagBlock($tags);
|
||||||
if (!$tags) {
|
if (!$tags) {
|
||||||
@@ -252,11 +252,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private function filterTagBlock($tags): ?string
|
||||||
* @param $tags
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
private function filterTagBlock($tags): string
|
|
||||||
{
|
{
|
||||||
$tags = trim($tags);
|
$tags = trim($tags);
|
||||||
if (!$tags) {
|
if (!$tags) {
|
||||||
|
|||||||
@@ -231,34 +231,6 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
$this->assertInstanceOf(Author::class, $tag);
|
$this->assertInstanceOf(Author::class, $tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::registerTagHandler
|
|
||||||
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
|
|
||||||
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testHandlerRegistrationFailsIfProvidedTagNameIsNotAString()
|
|
||||||
{
|
|
||||||
$resolver = m::mock(FqsenResolver::class);
|
|
||||||
$tagFactory = new StandardTagFactory($resolver);
|
|
||||||
|
|
||||||
$tagFactory->registerTagHandler([], Author::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::registerTagHandler
|
|
||||||
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
|
|
||||||
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testHandlerRegistrationFailsIfProvidedTagNameIsEmpty()
|
|
||||||
{
|
|
||||||
$resolver = m::mock(FqsenResolver::class);
|
|
||||||
$tagFactory = new StandardTagFactory($resolver);
|
|
||||||
|
|
||||||
$tagFactory->registerTagHandler('', Author::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::registerTagHandler
|
* @covers ::registerTagHandler
|
||||||
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
|
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
|
||||||
@@ -273,20 +245,6 @@ class StandardTagFactoryTest extends TestCase
|
|||||||
$tagFactory->registerTagHandler('Name\Spaced\Tag', Author::class);
|
$tagFactory->registerTagHandler('Name\Spaced\Tag', Author::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::registerTagHandler
|
|
||||||
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
|
|
||||||
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAString()
|
|
||||||
{
|
|
||||||
$resolver = m::mock(FqsenResolver::class);
|
|
||||||
$tagFactory = new StandardTagFactory($resolver);
|
|
||||||
|
|
||||||
$tagFactory->registerTagHandler('my-tag', []);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::registerTagHandler
|
* @covers ::registerTagHandler
|
||||||
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
|
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
|
||||||
|
|||||||
@@ -81,16 +81,6 @@ class AuthorTest extends TestCase
|
|||||||
$this->assertSame($expected, $fixture->getAuthorName());
|
$this->assertSame($expected, $fixture->getAuthorName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::__construct
|
|
||||||
* @covers ::getAuthorName
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testInitializationFailsIfAuthorNameIsNotAString()
|
|
||||||
{
|
|
||||||
new Author([], '[email protected]');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::__construct
|
* @covers ::__construct
|
||||||
* @covers ::getEmail
|
* @covers ::getEmail
|
||||||
@@ -104,15 +94,6 @@ class AuthorTest extends TestCase
|
|||||||
$this->assertSame($expected, $fixture->getEmail());
|
$this->assertSame($expected, $fixture->getEmail());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::__construct
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testInitializationFailsIfEmailIsNotAString()
|
|
||||||
{
|
|
||||||
new Author('Mike van Riel', []);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::__construct
|
* @covers ::__construct
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
|
|||||||
@@ -146,15 +146,6 @@ class CoversTest extends TestCase
|
|||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfBodyIsNotString()
|
|
||||||
{
|
|
||||||
$this->assertNull(Covers::create([]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
|
|||||||
@@ -74,70 +74,71 @@ class DeprecatedTest extends TestCase
|
|||||||
|
|
||||||
$this->assertSame('Rendered output', $fixture->render($formatter));
|
$this->assertSame('Rendered output', $fixture->render($formatter));
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @covers ::__construct
|
||||||
|
// * @covers ::getVersion
|
||||||
|
// */
|
||||||
|
// public function testHasVersionNumber()
|
||||||
|
// {
|
||||||
|
// $expected = '1.0';
|
||||||
|
//
|
||||||
|
// $fixture = new Deprecated($expected);
|
||||||
|
//
|
||||||
|
// $this->assertSame($expected, $fixture->getVersion());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @covers ::__construct
|
||||||
|
// * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
|
||||||
|
// * @uses \phpDocumentor\Reflection\DocBlock\Description
|
||||||
|
// */
|
||||||
|
// public function testHasDescription()
|
||||||
|
// {
|
||||||
|
// $expected = new Description('Description');
|
||||||
|
//
|
||||||
|
// $fixture = new Deprecated('1.0', $expected);
|
||||||
|
//
|
||||||
|
// $this->assertSame($expected, $fixture->getDescription());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @covers ::__construct
|
||||||
|
// * @covers ::__toString
|
||||||
|
// * @uses \phpDocumentor\Reflection\DocBlock\Description
|
||||||
|
// */
|
||||||
|
// public function testStringRepresentationIsReturned()
|
||||||
|
// {
|
||||||
|
// $fixture = new Deprecated('1.0', new Description('Description'));
|
||||||
|
//
|
||||||
|
// $this->assertSame('1.0 Description', (string)$fixture);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @covers ::create
|
||||||
|
// * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::<public>
|
||||||
|
// * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
|
||||||
|
// * @uses \phpDocumentor\Reflection\DocBlock\Description
|
||||||
|
// * @uses \phpDocumentor\Reflection\Types\Context
|
||||||
|
// */
|
||||||
|
// public function testFactoryMethod()
|
||||||
|
// {
|
||||||
|
// $descriptionFactory = m::mock(DescriptionFactory::class);
|
||||||
|
// $context = new Context('');
|
||||||
|
//
|
||||||
|
// $version = '1.0';
|
||||||
|
// $description = new Description('My Description');
|
||||||
|
//
|
||||||
|
// $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
||||||
|
//
|
||||||
|
// $fixture = Deprecated::create('1.0 My Description', $descriptionFactory, $context);
|
||||||
|
//
|
||||||
|
// $this->assertSame('1.0 My Description', (string)$fixture);
|
||||||
|
// $this->assertSame($version, $fixture->getVersion());
|
||||||
|
// $this->assertSame($description, $fixture->getDescription());
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
//
|
||||||
* @covers ::__construct
|
|
||||||
* @covers ::getVersion
|
|
||||||
*/
|
|
||||||
public function testHasVersionNumber()
|
|
||||||
{
|
|
||||||
$expected = '1.0';
|
|
||||||
|
|
||||||
$fixture = new Deprecated($expected);
|
|
||||||
|
|
||||||
$this->assertSame($expected, $fixture->getVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::__construct
|
|
||||||
* @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription
|
|
||||||
* @uses \phpDocumentor\Reflection\DocBlock\Description
|
|
||||||
*/
|
|
||||||
public function testHasDescription()
|
|
||||||
{
|
|
||||||
$expected = new Description('Description');
|
|
||||||
|
|
||||||
$fixture = new Deprecated('1.0', $expected);
|
|
||||||
|
|
||||||
$this->assertSame($expected, $fixture->getDescription());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::__construct
|
|
||||||
* @covers ::__toString
|
|
||||||
* @uses \phpDocumentor\Reflection\DocBlock\Description
|
|
||||||
*/
|
|
||||||
public function testStringRepresentationIsReturned()
|
|
||||||
{
|
|
||||||
$fixture = new Deprecated('1.0', new Description('Description'));
|
|
||||||
|
|
||||||
$this->assertSame('1.0 Description', (string)$fixture);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::<public>
|
|
||||||
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
|
|
||||||
* @uses \phpDocumentor\Reflection\DocBlock\Description
|
|
||||||
* @uses \phpDocumentor\Reflection\Types\Context
|
|
||||||
*/
|
|
||||||
public function testFactoryMethod()
|
|
||||||
{
|
|
||||||
$descriptionFactory = m::mock(DescriptionFactory::class);
|
|
||||||
$context = new Context('');
|
|
||||||
|
|
||||||
$version = '1.0';
|
|
||||||
$description = new Description('My Description');
|
|
||||||
|
|
||||||
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
|
|
||||||
|
|
||||||
$fixture = Deprecated::create('1.0 My Description', $descriptionFactory, $context);
|
|
||||||
|
|
||||||
$this->assertSame('1.0 My Description', (string)$fixture);
|
|
||||||
$this->assertSame($version, $fixture->getVersion());
|
|
||||||
$this->assertSame($description, $fixture->getDescription());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::<public>
|
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::<public>
|
||||||
@@ -152,18 +153,9 @@ class DeprecatedTest extends TestCase
|
|||||||
|
|
||||||
$fixture = Deprecated::create('', $descriptionFactory, new Context(''));
|
$fixture = Deprecated::create('', $descriptionFactory, new Context(''));
|
||||||
|
|
||||||
$this->assertSame('', (string)$fixture);
|
$this->assertSame('', (string) $fixture);
|
||||||
$this->assertSame(null, $fixture->getVersion());
|
$this->assertNull($fixture->getVersion());
|
||||||
$this->assertSame(null, $fixture->getDescription());
|
$this->assertNull($fixture->getDescription());
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfVersionIsNotString()
|
|
||||||
{
|
|
||||||
$this->assertNull(Deprecated::create([]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -125,15 +125,6 @@ class GenericTest extends TestCase
|
|||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfNameIsNotString()
|
|
||||||
{
|
|
||||||
Generic::create('', []);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
|
|||||||
@@ -156,13 +156,4 @@ class LinkTest extends TestCase
|
|||||||
$this->assertSame('', $fixture->getLink());
|
$this->assertSame('', $fixture->getLink());
|
||||||
$this->assertSame(null, $fixture->getDescription());
|
$this->assertSame(null, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfVersionIsNotString()
|
|
||||||
{
|
|
||||||
$this->assertNull(Link::create([]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,15 +367,6 @@ class MethodTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfBodyIsNotString()
|
|
||||||
{
|
|
||||||
Method::create([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
|
|||||||
@@ -190,15 +190,6 @@ class ParamTest extends TestCase
|
|||||||
Param::create('', new TypeResolver(), $descriptionFactory);
|
Param::create('', new TypeResolver(), $descriptionFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfBodyIsNotString()
|
|
||||||
{
|
|
||||||
Param::create([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
@@ -217,22 +208,4 @@ class ParamTest extends TestCase
|
|||||||
{
|
{
|
||||||
Param::create('body', new TypeResolver());
|
Param::create('body', new TypeResolver());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::__construct
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testExceptionIsThrownIfVariableNameIsNotString()
|
|
||||||
{
|
|
||||||
new Param([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::__construct
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testExceptionIsThrownIfVariadicIsNotBoolean()
|
|
||||||
{
|
|
||||||
new Param('', null, []);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,15 +176,6 @@ class PropertyReadTest extends TestCase
|
|||||||
PropertyRead::create('', new TypeResolver(), $descriptionFactory);
|
PropertyRead::create('', new TypeResolver(), $descriptionFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfBodyIsNotString()
|
|
||||||
{
|
|
||||||
PropertyRead::create([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
@@ -203,13 +194,4 @@ class PropertyReadTest extends TestCase
|
|||||||
{
|
{
|
||||||
PropertyRead::create('body', new TypeResolver());
|
PropertyRead::create('body', new TypeResolver());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::__construct
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testExceptionIsThrownIfVariableNameIsNotString()
|
|
||||||
{
|
|
||||||
new PropertyRead([]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,15 +171,6 @@ class PropertyTest extends TestCase
|
|||||||
Property::create('', new TypeResolver(), $descriptionFactory);
|
Property::create('', new TypeResolver(), $descriptionFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfBodyIsNotString()
|
|
||||||
{
|
|
||||||
Property::create([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
@@ -198,13 +189,4 @@ class PropertyTest extends TestCase
|
|||||||
{
|
{
|
||||||
Property::create('body', new TypeResolver());
|
Property::create('body', new TypeResolver());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::__construct
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testExceptionIsThrownIfVariableNameIsNotString()
|
|
||||||
{
|
|
||||||
new Property([]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,15 +176,6 @@ class PropertyWriteTest extends TestCase
|
|||||||
PropertyWrite::create('', new TypeResolver(), $descriptionFactory);
|
PropertyWrite::create('', new TypeResolver(), $descriptionFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfBodyIsNotString()
|
|
||||||
{
|
|
||||||
PropertyWrite::create([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
@@ -203,13 +194,4 @@ class PropertyWriteTest extends TestCase
|
|||||||
{
|
{
|
||||||
PropertyWrite::create('body', new TypeResolver());
|
PropertyWrite::create('body', new TypeResolver());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::__construct
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testExceptionIsThrownIfVariableNameIsNotString()
|
|
||||||
{
|
|
||||||
new PropertyWrite([]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,15 +142,6 @@ class ReturnTest extends TestCase
|
|||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfBodyIsNotString()
|
|
||||||
{
|
|
||||||
$this->assertNull(Return_::create([]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
|
|||||||
@@ -190,15 +190,6 @@ class SeeTest extends TestCase
|
|||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfBodyIsNotString()
|
|
||||||
{
|
|
||||||
$this->assertNull(See::create([]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
|
|||||||
@@ -158,15 +158,6 @@ class SinceTest extends TestCase
|
|||||||
$this->assertSame(null, $fixture->getDescription());
|
$this->assertSame(null, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfSinceIsNotString()
|
|
||||||
{
|
|
||||||
$this->assertNull(Since::create([]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -168,15 +168,6 @@ class SourceTest extends TestCase
|
|||||||
Source::create('', $descriptionFactory);
|
Source::create('', $descriptionFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfBodyIsNotString()
|
|
||||||
{
|
|
||||||
Source::create([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @uses \phpDocumentor\Reflection\TypeResolver
|
* @uses \phpDocumentor\Reflection\TypeResolver
|
||||||
|
|||||||
@@ -142,15 +142,6 @@ class ThrowsTest extends TestCase
|
|||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfBodyIsNotString()
|
|
||||||
{
|
|
||||||
$this->assertNull(Throws::create([]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
|
|||||||
@@ -145,15 +145,6 @@ class UsesTest extends TestCase
|
|||||||
$this->assertSame($description, $fixture->getDescription());
|
$this->assertSame($description, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfBodyIsNotString()
|
|
||||||
{
|
|
||||||
$this->assertNull(Uses::create([]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
|
|||||||
@@ -182,15 +182,6 @@ class VarTest extends TestCase
|
|||||||
Var_::create('', new TypeResolver(), $descriptionFactory);
|
Var_::create('', new TypeResolver(), $descriptionFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfBodyIsNotString()
|
|
||||||
{
|
|
||||||
Var_::create([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
* @expectedException \InvalidArgumentException
|
* @expectedException \InvalidArgumentException
|
||||||
@@ -209,13 +200,4 @@ class VarTest extends TestCase
|
|||||||
{
|
{
|
||||||
Var_::create('body', new TypeResolver());
|
Var_::create('body', new TypeResolver());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::__construct
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testExceptionIsThrownIfVariableNameIsNotString()
|
|
||||||
{
|
|
||||||
new Var_([]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,15 +157,6 @@ class VersionTest extends TestCase
|
|||||||
$this->assertSame(null, $fixture->getDescription());
|
$this->assertSame(null, $fixture->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers ::create
|
|
||||||
* @expectedException \InvalidArgumentException
|
|
||||||
*/
|
|
||||||
public function testFactoryMethodFailsIfVersionIsNotString()
|
|
||||||
{
|
|
||||||
$this->assertNull(Version::create([]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::create
|
* @covers ::create
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user