mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Refactored 90% of the library
This commit is contained in:
committed by
Mike van Riel
parent
58d09836c1
commit
18ef0a8055
@@ -1,94 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<[email protected]>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock {
|
||||
|
||||
// Added imports on purpose as mock for the unit tests, please do not remove.
|
||||
use Mockery as m;
|
||||
use phpDocumentor\Reflection\DocBlock,
|
||||
phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use \ReflectionClass; // yes, the slash is part of the test
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \phpDocumentor\Reflection\DocBlock\ContextFactory
|
||||
* @covers ::<private>
|
||||
*/
|
||||
class ContextFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers ::createFromClassReflector
|
||||
* @covers ::createForNamespace
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
*/
|
||||
public function testReadsNamespaceFromClassReflection()
|
||||
{
|
||||
$fixture = new ContextFactory();
|
||||
$context = $fixture->createFromClassReflector(new ReflectionClass($this));
|
||||
|
||||
$this->assertSame(__NAMESPACE__, $context->getNamespace());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::createFromClassReflector
|
||||
* @covers ::createForNamespace
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
*/
|
||||
public function testReadsAliasesFromClassReflection()
|
||||
{
|
||||
$fixture = new ContextFactory();
|
||||
$expected = [
|
||||
'm' => 'Mockery',
|
||||
'DocBlock' => 'phpDocumentor\Reflection\DocBlock',
|
||||
'Tag' => 'phpDocumentor\Reflection\DocBlock\Tag',
|
||||
'ReflectionClass' => 'ReflectionClass'
|
||||
];
|
||||
$context = $fixture->createFromClassReflector(new ReflectionClass($this));
|
||||
|
||||
$this->assertSame($expected, $context->getNamespaceAliases());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::createForNamespace
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
*/
|
||||
public function testReadsNamespaceFromProvidedNamespaceAndContent()
|
||||
{
|
||||
$fixture = new ContextFactory();
|
||||
$context = $fixture->createForNamespace(__NAMESPACE__, file_get_contents(__FILE__));
|
||||
|
||||
$this->assertSame(__NAMESPACE__, $context->getNamespace());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::createForNamespace
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
*/
|
||||
public function testReadsAliasesFromProvidedNamespaceAndContent()
|
||||
{
|
||||
$fixture = new ContextFactory();
|
||||
$expected = [
|
||||
'm' => 'Mockery',
|
||||
'DocBlock' => 'phpDocumentor\Reflection\DocBlock',
|
||||
'Tag' => 'phpDocumentor\Reflection\DocBlock\Tag',
|
||||
'ReflectionClass' => 'ReflectionClass'
|
||||
];
|
||||
$context = $fixture->createForNamespace(__NAMESPACE__, file_get_contents(__FILE__));
|
||||
|
||||
$this->assertSame($expected, $context->getNamespaceAliases());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Mock {
|
||||
// the following import should not show in the tests above
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<[email protected]>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use Mockery as m;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \phpDocumentor\Reflection\DocBlock\Context
|
||||
*/
|
||||
class ContextTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers ::__construct
|
||||
* @covers ::getNamespace
|
||||
*/
|
||||
public function testProvidesANormalizedNamespace()
|
||||
{
|
||||
$fixture = new Context('\My\Space');
|
||||
$this->assertSame('My\Space', $fixture->getNamespace());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::__construct
|
||||
* @covers ::getNamespace
|
||||
*/
|
||||
public function testInterpretsNamespaceNamedGlobalAsRootNamespace()
|
||||
{
|
||||
$fixture = new Context('global');
|
||||
$this->assertSame('', $fixture->getNamespace());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::__construct
|
||||
* @covers ::getNamespace
|
||||
*/
|
||||
public function testInterpretsNamespaceNamedDefaultAsRootNamespace()
|
||||
{
|
||||
$fixture = new Context('default');
|
||||
$this->assertSame('', $fixture->getNamespace());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::__construct
|
||||
* @covers ::getNamespaceAliases
|
||||
*/
|
||||
public function testProvidesNormalizedNamespaceAliases()
|
||||
{
|
||||
$fixture = new Context('', ['Space' => '\My\Space']);
|
||||
$this->assertSame(['Space' => 'My\Space'], $fixture->getNamespaceAliases());
|
||||
}
|
||||
}
|
||||
@@ -1,245 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Description Test
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <[email protected]>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Description
|
||||
*
|
||||
* @author Vasil Rangelov <[email protected]>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class DescriptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(1, $parsedContents);
|
||||
$this->assertSame($fixture, $parsedContents[0]);
|
||||
}
|
||||
|
||||
public function testInlineTagParsing()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a {@link http://phpdoc.org/ description} that uses inline
|
||||
tags.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
$this->assertSame('This is text for a ', $parsedContents[0]);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag\LinkTag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame(
|
||||
' that uses inline
|
||||
tags.',
|
||||
$parsedContents[2]
|
||||
);
|
||||
}
|
||||
|
||||
public function testInlineTagAtStartParsing()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
{@link http://phpdoc.org/ This} is text for a description that uses inline
|
||||
tags.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
|
||||
$this->assertSame('', $parsedContents[0]);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag\LinkTag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame(
|
||||
' is text for a description that uses inline
|
||||
tags.',
|
||||
$parsedContents[2]
|
||||
);
|
||||
}
|
||||
|
||||
public function testNestedInlineTagParsing()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with {@internal inline tag with
|
||||
{@link http://phpdoc.org another inline tag} in it}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
|
||||
$this->assertSame(
|
||||
'This is text for a description with ',
|
||||
$parsedContents[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame('.', $parsedContents[2]);
|
||||
|
||||
$parsedDescription = $parsedContents[1]->getParsedDescription();
|
||||
$this->assertCount(3, $parsedDescription);
|
||||
$this->assertSame("inline tag with\n", $parsedDescription[0]);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag\LinkTag',
|
||||
$parsedDescription[1]
|
||||
);
|
||||
$this->assertSame(' in it', $parsedDescription[2]);
|
||||
}
|
||||
|
||||
public function testLiteralOpeningDelimiter()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description containing { that is literal.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(1, $parsedContents);
|
||||
$this->assertSame($fixture, $parsedContents[0]);
|
||||
}
|
||||
|
||||
public function testNestedLiteralOpeningDelimiter()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description containing {@internal inline tag that has { that
|
||||
is literal}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description containing ',
|
||||
$parsedContents[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame('.', $parsedContents[2]);
|
||||
|
||||
$this->assertSame(
|
||||
array('inline tag that has { that
|
||||
is literal'),
|
||||
$parsedContents[1]->getParsedDescription()
|
||||
);
|
||||
}
|
||||
|
||||
public function testLiteralClosingDelimiter()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with {} that is not a tag.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(1, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description with } that is not a tag.',
|
||||
$parsedContents[0]
|
||||
);
|
||||
}
|
||||
|
||||
public function testNestedLiteralClosingDelimiter()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with {@internal inline tag with {} that is not an
|
||||
inline tag}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description with ',
|
||||
$parsedContents[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame('.', $parsedContents[2]);
|
||||
|
||||
$this->assertSame(
|
||||
array('inline tag with } that is not an
|
||||
inline tag'),
|
||||
$parsedContents[1]->getParsedDescription()
|
||||
);
|
||||
}
|
||||
|
||||
public function testInlineTagEscapingSequence()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with literal {{@}link}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(1, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description with literal {@link}.',
|
||||
$parsedContents[0]
|
||||
);
|
||||
}
|
||||
|
||||
public function testNestedInlineTagEscapingSequence()
|
||||
{
|
||||
$fixture = <<<LONGDESC
|
||||
This is text for a description with an {@internal inline tag with literal
|
||||
{{@}link{} in it}.
|
||||
LONGDESC;
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->getContents());
|
||||
|
||||
$parsedContents = $object->getParsedContents();
|
||||
$this->assertCount(3, $parsedContents);
|
||||
$this->assertSame(
|
||||
'This is text for a description with an ',
|
||||
$parsedContents[0]
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
__NAMESPACE__ . '\Tag',
|
||||
$parsedContents[1]
|
||||
);
|
||||
$this->assertSame('.', $parsedContents[2]);
|
||||
|
||||
$this->assertSame(
|
||||
array('inline tag with literal
|
||||
{@link} in it'),
|
||||
$parsedContents[1]->getParsedDescription()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Collection Test
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Mike van Riel <[email protected]>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Type;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Context;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Type\Collection
|
||||
*
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection
|
||||
*
|
||||
* @author Mike van Riel <[email protected]>
|
||||
* @copyright 2010-2011 Mike van Riel / Naenius. (http://www.naenius.com)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class CollectionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::getContext
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstruct()
|
||||
{
|
||||
$collection = new Collection();
|
||||
$this->assertCount(0, $collection);
|
||||
$this->assertEquals('', $collection->getContext()->getNamespace());
|
||||
$this->assertCount(0, $collection->getContext()->getNamespaceAliases());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructWithTypes()
|
||||
{
|
||||
$collection = new Collection(array('integer', 'string'));
|
||||
$this->assertCount(2, $collection);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructWithNamespace()
|
||||
{
|
||||
$collection = new Collection(array(), new Context('\My\Space'));
|
||||
$this->assertEquals('My\Space', $collection->getContext()->getNamespace());
|
||||
|
||||
$collection = new Collection(array(), new Context('My\Space'));
|
||||
$this->assertEquals('My\Space', $collection->getContext()->getNamespace());
|
||||
|
||||
$collection = new Collection(array(), null);
|
||||
$this->assertEquals('', $collection->getContext()->getNamespace());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::__construct
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructWithNamespaceAliases()
|
||||
{
|
||||
$fixture = array('a' => 'b');
|
||||
$collection = new Collection(array(), new Context(null, $fixture));
|
||||
$this->assertEquals(
|
||||
array('a' => '\b'),
|
||||
$collection->getContext()->getNamespaceAliases()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fixture
|
||||
* @param array $expected
|
||||
*
|
||||
* @dataProvider provideTypesToExpand
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAdd($fixture, $expected)
|
||||
{
|
||||
$collection = new Collection(
|
||||
array(),
|
||||
new Context('\My\Space', array('Alias' => '\My\Space\Aliasing'))
|
||||
);
|
||||
$collection->add($fixture);
|
||||
|
||||
$this->assertSame($expected, $collection->getArrayCopy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fixture
|
||||
* @param array $expected
|
||||
*
|
||||
* @dataProvider provideTypesToExpandWithoutNamespace
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddWithoutNamespace($fixture, $expected)
|
||||
{
|
||||
$collection = new Collection(
|
||||
array(),
|
||||
new Context(null, array('Alias' => '\My\Space\Aliasing'))
|
||||
);
|
||||
$collection->add($fixture);
|
||||
|
||||
$this->assertSame($expected, $collection->getArrayCopy());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add
|
||||
* @expectedException InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddWithInvalidArgument()
|
||||
{
|
||||
$collection = new Collection();
|
||||
$collection->add(array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the types and their expected values to test the retrieval of
|
||||
* types.
|
||||
*
|
||||
* @param string $method Name of the method consuming this data provider.
|
||||
* @param string $namespace Name of the namespace to user as basis.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function provideTypesToExpand($method, $namespace = '\My\Space\\')
|
||||
{
|
||||
return array(
|
||||
array('', array()),
|
||||
array(' ', array()),
|
||||
array('int', array('int')),
|
||||
array('int ', array('int')),
|
||||
array('string', array('string')),
|
||||
array('DocBlock', array($namespace.'DocBlock')),
|
||||
array('DocBlock[]', array($namespace.'DocBlock[]')),
|
||||
array(' DocBlock ', array($namespace.'DocBlock')),
|
||||
array('\My\Space\DocBlock', array('\My\Space\DocBlock')),
|
||||
array('Alias\DocBlock', array('\My\Space\Aliasing\DocBlock')),
|
||||
array(
|
||||
'DocBlock|Tag',
|
||||
array($namespace .'DocBlock', $namespace .'Tag')
|
||||
),
|
||||
array(
|
||||
'DocBlock|null',
|
||||
array($namespace.'DocBlock', 'null')
|
||||
),
|
||||
array(
|
||||
'\My\Space\DocBlock|Tag',
|
||||
array('\My\Space\DocBlock', $namespace.'Tag')
|
||||
),
|
||||
array(
|
||||
'DocBlock[]|null',
|
||||
array($namespace.'DocBlock[]', 'null')
|
||||
),
|
||||
array(
|
||||
'DocBlock[]|int[]',
|
||||
array($namespace.'DocBlock[]', 'int[]')
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the types and their expected values to test the retrieval of
|
||||
* types when no namespace is available.
|
||||
*
|
||||
* @param string $method Name of the method consuming this data provider.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function provideTypesToExpandWithoutNamespace($method)
|
||||
{
|
||||
return $this->provideTypesToExpand($method, '\\');
|
||||
}
|
||||
}
|
||||
@@ -1,348 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<[email protected]>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\Types;
|
||||
|
||||
use Mockery as m;
|
||||
use phpDocumentor\Reflection\DocBlock\Context;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass phpDocumentor\Reflection\Types\Resolver
|
||||
*/
|
||||
class ResolverTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @param string $keyword
|
||||
* @param string $expectedClass
|
||||
*
|
||||
* @covers ::resolve
|
||||
* @covers ::<private>
|
||||
*
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
* @uses phpDocumentor\Reflection\Types\Array_
|
||||
* @uses phpDocumentor\Reflection\Types\Object_
|
||||
*
|
||||
* @dataProvider provideKeywords
|
||||
*/
|
||||
public function testResolvingKeywords($keyword, $expectedClass)
|
||||
{
|
||||
$fixture = new Resolver();
|
||||
|
||||
$resolvedType = $fixture->resolve($keyword, new Context(''));
|
||||
|
||||
$this->assertInstanceOf($expectedClass, $resolvedType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fqsen
|
||||
*
|
||||
* @covers ::resolve
|
||||
* @covers ::<private>
|
||||
*
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
* @uses phpDocumentor\Reflection\Types\Object_
|
||||
* @uses phpDocumentor\Reflection\Fqsen
|
||||
*
|
||||
* @dataProvider provideFqsen
|
||||
*/
|
||||
public function testResolvingFQSENs($fqsen)
|
||||
{
|
||||
$fixture = new Resolver();
|
||||
|
||||
/** @var Object_ $resolvedType */
|
||||
$resolvedType = $fixture->resolve($fqsen, new Context(''));
|
||||
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Object_', $resolvedType);
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Fqsen', $resolvedType->getFqsen());
|
||||
$this->assertSame($fqsen, (string)$resolvedType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @covers ::resolve
|
||||
* @covers ::<private>
|
||||
*
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
* @uses phpDocumentor\Reflection\Types\Object_
|
||||
* @uses phpDocumentor\Reflection\Fqsen
|
||||
*/
|
||||
public function testResolvingRelativeQSENsBasedOnNamespace()
|
||||
{
|
||||
$fixture = new Resolver();
|
||||
|
||||
/** @var Object_ $resolvedType */
|
||||
$resolvedType = $fixture->resolve('DocBlock', new Context('phpDocumentor\Reflection'));
|
||||
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Object_', $resolvedType);
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Fqsen', $resolvedType->getFqsen());
|
||||
$this->assertSame('\phpDocumentor\Reflection\DocBlock', (string)$resolvedType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::resolve
|
||||
* @covers ::<private>
|
||||
*
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
* @uses phpDocumentor\Reflection\Types\Object_
|
||||
* @uses phpDocumentor\Reflection\Fqsen
|
||||
*/
|
||||
public function testResolvingRelativeQSENsBasedOnNamespaceAlias()
|
||||
{
|
||||
$fixture = new Resolver();
|
||||
|
||||
/** @var Object_ $resolvedType */
|
||||
$resolvedType = $fixture->resolve(
|
||||
'm\MockInterface',
|
||||
new Context('phpDocumentor\Reflection', ['m' => '\Mockery'])
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Object_', $resolvedType);
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Fqsen', $resolvedType->getFqsen());
|
||||
$this->assertSame('\Mockery\MockInterface', (string)$resolvedType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::resolve
|
||||
* @covers ::<private>
|
||||
*
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
* @uses phpDocumentor\Reflection\Types\Array_
|
||||
* @uses phpDocumentor\Reflection\Types\String
|
||||
*/
|
||||
public function testResolvingTypedArrays()
|
||||
{
|
||||
$fixture = new Resolver();
|
||||
|
||||
/** @var Array_ $resolvedType */
|
||||
$resolvedType = $fixture->resolve('string[]', new Context(''));
|
||||
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Array_', $resolvedType);
|
||||
$this->assertSame('string[]', (string)$resolvedType);
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Mixed', $resolvedType->getKeyType());
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\String', $resolvedType->getValueType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::resolve
|
||||
* @covers ::<private>
|
||||
*
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
* @uses phpDocumentor\Reflection\Types\Array_
|
||||
* @uses phpDocumentor\Reflection\Types\String
|
||||
*/
|
||||
public function testResolvingNestedTypedArrays()
|
||||
{
|
||||
$fixture = new Resolver();
|
||||
|
||||
/** @var Array_ $resolvedType */
|
||||
$resolvedType = $fixture->resolve('string[][]', new Context(''));
|
||||
|
||||
/** @var Array_ $childValueType */
|
||||
$childValueType = $resolvedType->getValueType();
|
||||
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Array_', $resolvedType);
|
||||
|
||||
$this->assertSame('string[][]', (string)$resolvedType);
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Mixed', $resolvedType->getKeyType());
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Array_', $childValueType);
|
||||
|
||||
$this->assertSame('string[]', (string)$childValueType);
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Mixed', $childValueType->getKeyType());
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\String', $childValueType->getValueType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::resolve
|
||||
* @covers ::<private>
|
||||
*
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
* @uses phpDocumentor\Reflection\Types\Compound
|
||||
* @uses phpDocumentor\Reflection\Types\String
|
||||
* @uses phpDocumentor\Reflection\Types\Object_
|
||||
* @uses phpDocumentor\Reflection\Fqsen
|
||||
*/
|
||||
public function testResolvingCompoundTypes()
|
||||
{
|
||||
$fixture = new Resolver();
|
||||
|
||||
/** @var Compound $resolvedType */
|
||||
$resolvedType = $fixture->resolve('string|Reflection\DocBlock', new Context('phpDocumentor'));
|
||||
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Compound', $resolvedType);
|
||||
$this->assertSame('string|\phpDocumentor\Reflection\DocBlock', (string)$resolvedType);
|
||||
|
||||
/** @var String $secondType */
|
||||
$firstType = $resolvedType->get(0);
|
||||
|
||||
/** @var Object_ $secondType */
|
||||
$secondType = $resolvedType->get(1);
|
||||
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\String', $firstType);
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Object_', $secondType);
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Fqsen', $secondType->getFqsen());
|
||||
}
|
||||
|
||||
/**
|
||||
* This test asserts that the parameter order is correct.
|
||||
*
|
||||
* When you pass two arrays separated by the compound operator (i.e. 'integer[]|string[]') then we always split the
|
||||
* expression in its compound parts and then we parse the types with the array operators. If we were to switch the
|
||||
* order around then 'integer[]|string[]' would read as an array of string or integer array; which is something
|
||||
* other than what we intend.
|
||||
*
|
||||
* @covers ::resolve
|
||||
* @covers ::<private>
|
||||
*
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
* @uses phpDocumentor\Reflection\Types\Compound
|
||||
* @uses phpDocumentor\Reflection\Types\Array_
|
||||
* @uses phpDocumentor\Reflection\Types\Integer
|
||||
* @uses phpDocumentor\Reflection\Types\String
|
||||
*/
|
||||
public function testResolvingCompoundTypesWithTwoArrays()
|
||||
{
|
||||
$fixture = new Resolver();
|
||||
|
||||
/** @var Compound $resolvedType */
|
||||
$resolvedType = $fixture->resolve('integer[]|string[]', new Context(''));
|
||||
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Compound', $resolvedType);
|
||||
$this->assertSame('int[]|string[]', (string)$resolvedType);
|
||||
|
||||
/** @var Array_ $firstType */
|
||||
$firstType = $resolvedType->get(0);
|
||||
|
||||
/** @var Array_ $secondType */
|
||||
$secondType = $resolvedType->get(1);
|
||||
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Array_', $firstType);
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Integer', $firstType->getValueType());
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\Array_', $secondType);
|
||||
$this->assertInstanceOf('phpDocumentor\Reflection\Types\String', $secondType->getValueType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::addKeyword
|
||||
* @uses phpDocumentor\Reflection\Types\Resolver::resolve
|
||||
* @uses phpDocumentor\Reflection\Types\Resolver::<private>
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
*/
|
||||
public function testAddingAKeyword()
|
||||
{
|
||||
// Assign
|
||||
$typeMock = m::mock(Type::class);
|
||||
|
||||
// Act
|
||||
$fixture = new Resolver();
|
||||
$fixture->addKeyword('mock', get_class($typeMock));
|
||||
|
||||
// Assert
|
||||
$result = $fixture->resolve('mock', new Context(''));
|
||||
$this->assertInstanceOf(get_class($typeMock), $result);
|
||||
$this->assertNotSame($typeMock, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::addKeyword
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testAddingAKeywordFailsIfTypeClassDoesNotExist()
|
||||
{
|
||||
$fixture = new Resolver();
|
||||
$fixture->addKeyword('mock', 'IDoNotExist');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::addKeyword
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testAddingAKeywordFailsIfTypeClassDoesNotImplementTypeInterface()
|
||||
{
|
||||
$fixture = new Resolver();
|
||||
$fixture->addKeyword('mock', 'stdClass');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::resolve
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
*
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testExceptionIsThrownIfTypeIsEmpty()
|
||||
{
|
||||
$fixture = new Resolver();
|
||||
$fixture->resolve(' ', new Context(''));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::resolve
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Context
|
||||
*
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testExceptionIsThrownIfTypeIsNotAString()
|
||||
{
|
||||
$fixture = new Resolver();
|
||||
$fixture->resolve(['a'], new Context(''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of keywords and expected classes that are created from them.
|
||||
*
|
||||
* @return string[][]
|
||||
*/
|
||||
public function provideKeywords()
|
||||
{
|
||||
return [
|
||||
['string', 'phpDocumentor\Reflection\Types\String'],
|
||||
['int', 'phpDocumentor\Reflection\Types\Integer'],
|
||||
['integer', 'phpDocumentor\Reflection\Types\Integer'],
|
||||
['float', 'phpDocumentor\Reflection\Types\Float'],
|
||||
['double', 'phpDocumentor\Reflection\Types\Float'],
|
||||
['bool', 'phpDocumentor\Reflection\Types\Boolean'],
|
||||
['boolean', 'phpDocumentor\Reflection\Types\Boolean'],
|
||||
['resource', 'phpDocumentor\Reflection\Types\Resource'],
|
||||
['null', 'phpDocumentor\Reflection\Types\Null_'],
|
||||
['callable', 'phpDocumentor\Reflection\Types\Callable_'],
|
||||
['callback', 'phpDocumentor\Reflection\Types\Callable_'],
|
||||
['array', 'phpDocumentor\Reflection\Types\Array_'],
|
||||
['scalar', 'phpDocumentor\Reflection\Types\Scalar'],
|
||||
['object', 'phpDocumentor\Reflection\Types\Object_'],
|
||||
['mixed', 'phpDocumentor\Reflection\Types\Mixed'],
|
||||
['void', 'phpDocumentor\Reflection\Types\Void'],
|
||||
['$this', 'phpDocumentor\Reflection\Types\This'],
|
||||
['static', 'phpDocumentor\Reflection\Types\Static_'],
|
||||
['self', 'phpDocumentor\Reflection\Types\Self_'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a list of FQSENs to test the resolution patterns with.
|
||||
*
|
||||
* @return string[][]
|
||||
*/
|
||||
public function provideFqsen()
|
||||
{
|
||||
return [
|
||||
'namespace' => ['\phpDocumentor\Reflection'],
|
||||
'class' => ['\phpDocumentor\Reflection\DocBlock'],
|
||||
'function' => ['\DI\object()'],
|
||||
'constant' => ['\phpDocumentor\Reflection\GLOBAL_CONSTANT'],
|
||||
'classConstant' => ['\phpDocumentor\Reflection\DocBlock::CONSTANT'],
|
||||
'property' => ['\phpDocumentor\Reflection\DocBlock::$summary'],
|
||||
'method' => ['\phpDocumentor\Reflection\DocBlock::getSummary()'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of phpDocumentor.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright 2010-2015 Mike van Riel<[email protected]>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use Mockery as m;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Deprecated;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Link;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \phpDocumentor\Reflection\DocBlock\Description
|
||||
*/
|
||||
class DescriptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @param array $examples
|
||||
* @dataProvider provideExampleDescriptions
|
||||
* @covers ::__construct
|
||||
* @covers ::render
|
||||
* @covers ::parse
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Description\PassthroughFormatter
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Tag
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Tags\Link
|
||||
*/
|
||||
public function testParsesDescription($example)
|
||||
{
|
||||
$object = new Description($example);
|
||||
|
||||
$this->assertSame($example, $object->render());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::__construct
|
||||
* @covers ::render
|
||||
* @covers ::parse
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Description\PassthroughFormatter
|
||||
*/
|
||||
public function testInlineTagEscapingSequence()
|
||||
{
|
||||
$fixture = 'This is text for a description with literal {{@}link}.';
|
||||
$expected = 'This is text for a description with literal {@link}.';
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($expected, $object->render());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::__construct
|
||||
* @covers ::render
|
||||
* @covers ::parse
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Tag
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Tags\Version
|
||||
* @uses phpDocumentor\Reflection\DocBlock\Tags\Link
|
||||
*/
|
||||
public function testFormatterReceivesContentsAsTokens()
|
||||
{
|
||||
$fixture = <<<DESCRIPTION
|
||||
This is a description with {a} {@link http://phpdoc.org/ link} or {@deprecated inline tag with {@link http://phpdoc.org
|
||||
another link} in it}. Here is a solitary } and a { to test the regex. We can also escape at-signs like this
|
||||
{@}example.com or {{@}link}.
|
||||
DESCRIPTION;
|
||||
|
||||
$expected = [
|
||||
'This is a description with {a} ',
|
||||
Link::create('@link http://phpdoc.org/ link'),
|
||||
' or ',
|
||||
Deprecated::create("@deprecated inline tag with {@link http://phpdoc.org\nanother link} in it"),
|
||||
". Here is a solitary } and a { to test the regex. We can also escape at-signs like this\n"
|
||||
. "@example.com or {@link}."
|
||||
];
|
||||
|
||||
$formatter = m::mock('phpDocumentor\Reflection\DocBlock\Description\Formatter');
|
||||
$formatter->shouldReceive('format')->with($expected)->andReturn($fixture);
|
||||
|
||||
$object = new Description($fixture);
|
||||
$this->assertSame($fixture, $object->render($formatter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a series of example strings that the parser should correctly interpret and return.
|
||||
*
|
||||
* @return string[][]
|
||||
*/
|
||||
public function provideExampleDescriptions()
|
||||
{
|
||||
return [
|
||||
['This is text for a description.'],
|
||||
['This is text for a {@link http://phpdoc.org/ description} that uses an inline tag.'],
|
||||
['{@link http://phpdoc.org/ This} is text for a description that starts with an inline tag.'],
|
||||
[
|
||||
'This is text for a description with {@internal inline tag with {@link http://phpdoc.org another '
|
||||
. 'inline tag} in it}.'
|
||||
],
|
||||
['This is text for a description containing { that is literal.'],
|
||||
['This is text for a description containing {@internal inline tag that has { that is literal}.'],
|
||||
['This is text for a description with {} that is not a tag.'],
|
||||
['This is text for a description with {@internal inline tag with {} that is not an inline tag}.'],
|
||||
['This is text for a description with an {@internal inline tag with literal {{@}link{} in it}.']
|
||||
];
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Covers Tag Test
|
||||
*
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
@@ -10,7 +10,7 @@
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
/**
|
||||
* Test class for \phpDocumentor\Reflection\DocBlock\Tag\CoversTag
|
||||
@@ -20,10 +20,10 @@ namespace phpDocumentor\Reflection\DocBlock\Tag;
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
class CoversTagTest extends \PHPUnit_Framework_TestCase
|
||||
class CoversTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tag\CoversTag can create
|
||||
* Test that the \phpDocumentor\Reflection\DocBlock\Tags\Covers can create
|
||||
* a link for the covers doc block.
|
||||
*
|
||||
* @param string $type
|
||||
@@ -43,7 +43,7 @@ class CoversTagTest extends \PHPUnit_Framework_TestCase
|
||||
$exDescription,
|
||||
$exReference
|
||||
) {
|
||||
$tag = new CoversTag($type, $content);
|
||||
$tag = new Covers($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Example Tag Test
|
||||
*
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
@@ -47,7 +47,7 @@ class ExampleTagTest extends \PHPUnit_Framework_TestCase
|
||||
$exLineCount,
|
||||
$exFilePath
|
||||
) {
|
||||
$tag = new ExampleTag($type, $content);
|
||||
$tag = new Example($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Return tag test.
|
||||
*
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
@@ -44,7 +44,7 @@ class ReturnTagTest extends \PHPUnit_Framework_TestCase
|
||||
$extractedTypes,
|
||||
$extractedDescription
|
||||
) {
|
||||
$tag = new ReturnTag($type, $content);
|
||||
$tag = new Return_($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($extractedType, $tag->getType());
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor See Tag Test
|
||||
*
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
@@ -43,7 +43,7 @@ class SeeTagTest extends \PHPUnit_Framework_TestCase
|
||||
$exDescription,
|
||||
$exReference
|
||||
) {
|
||||
$tag = new SeeTag($type, $content);
|
||||
$tag = new See($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Since Tag Test
|
||||
*
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
@@ -44,7 +44,7 @@ class SinceTagTest extends \PHPUnit_Framework_TestCase
|
||||
$exDescription,
|
||||
$exVersion
|
||||
) {
|
||||
$tag = new SinceTag($type, $content);
|
||||
$tag = new Since($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Source Tag Test
|
||||
*
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
@@ -45,7 +45,7 @@ class SourceTagTest extends \PHPUnit_Framework_TestCase
|
||||
$exStartingLine,
|
||||
$exLineCount
|
||||
) {
|
||||
$tag = new SourceTag($type, $content);
|
||||
$tag = new Source($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Throws tag test.
|
||||
*
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Mike van Riel <mike.vanriel@naenius.com>
|
||||
@@ -44,7 +44,7 @@ class ThrowsTagTest extends \PHPUnit_Framework_TestCase
|
||||
$extractedTypes,
|
||||
$extractedDescription
|
||||
) {
|
||||
$tag = new ThrowsTag($type, $content);
|
||||
$tag = new Throws($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($extractedType, $tag->getType());
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Uses Tag Test
|
||||
*
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Daniel O'Connor <daniel.oconnor@gmail.com>
|
||||
@@ -43,7 +43,7 @@ class UsesTagTest extends \PHPUnit_Framework_TestCase
|
||||
$exDescription,
|
||||
$exReference
|
||||
) {
|
||||
$tag = new UsesTag($type, $content);
|
||||
$tag = new Uses($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* phpDocumentor Version Tag Test
|
||||
*
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
@@ -44,7 +44,7 @@ class VersionTagTest extends \PHPUnit_Framework_TestCase
|
||||
$exDescription,
|
||||
$exVersion
|
||||
) {
|
||||
$tag = new VersionTag($type, $content);
|
||||
$tag = new Version($type, $content);
|
||||
|
||||
$this->assertEquals($type, $tag->getName());
|
||||
$this->assertEquals($exContent, $tag->getContent());
|
||||
@@ -14,7 +14,7 @@ namespace phpDocumentor\Reflection;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Context;
|
||||
use phpDocumentor\Reflection\DocBlock\Location;
|
||||
use phpDocumentor\Reflection\DocBlock\Tag\ReturnTag;
|
||||
use phpDocumentor\Reflection\DocBlock\Tag\Return_;
|
||||
|
||||
/**
|
||||
* Test class for phpDocumentor\Reflection\DocBlock
|
||||
@@ -28,7 +28,7 @@ class DocBlockTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstruct()
|
||||
@@ -60,7 +60,7 @@ DOCBLOCK;
|
||||
$this->assertTrue($object->hasTag('see'));
|
||||
$this->assertTrue($object->hasTag('return'));
|
||||
$this->assertFalse($object->hasTag('category'));
|
||||
|
||||
|
||||
$this->assertSame('MyNamespace', $object->getContext()->getNamespace());
|
||||
$this->assertSame(
|
||||
array('PHPDoc' => '\phpDocumentor'),
|
||||
@@ -128,7 +128,7 @@ DOCBLOCK;
|
||||
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::cleanInput
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructOneLiner()
|
||||
@@ -145,7 +145,7 @@ DOCBLOCK;
|
||||
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::__construct
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructFromReflector()
|
||||
@@ -166,7 +166,7 @@ DOCBLOCK;
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExceptionOnInvalidObject()
|
||||
@@ -198,7 +198,7 @@ DOCBLOCK;
|
||||
/**
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::parseTags
|
||||
* @expectedException \LogicException
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testInvalidTagBlock()
|
||||
@@ -218,7 +218,7 @@ class MyReflectionDocBlock extends \phpDocumentor\Reflection\DocBlock {
|
||||
DOCBLOCK_EXTENSION
|
||||
);
|
||||
new \MyReflectionDocBlock('');
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testTagCaseSensitivity()
|
||||
@@ -263,7 +263,7 @@ DOCBLOCK;
|
||||
/**
|
||||
* @depends testConstructFromReflector
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::getTagsByName
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetTagsByNameZeroAndOneMatch()
|
||||
@@ -276,7 +276,7 @@ DOCBLOCK;
|
||||
/**
|
||||
* @depends testConstructWithTagsOnly
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::parseTags
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testParseMultilineTag()
|
||||
@@ -294,7 +294,7 @@ DOCBLOCK;
|
||||
/**
|
||||
* @depends testConstructWithTagsOnly
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::parseTags
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testParseMultilineTagWithLineBreaks()
|
||||
@@ -309,7 +309,7 @@ DOCBLOCK;
|
||||
DOCBLOCK;
|
||||
$object = new DocBlock($fixture);
|
||||
$this->assertCount(1, $tags = $object->getTags());
|
||||
/** @var ReturnTag $tag */
|
||||
/** @var Return_ $tag */
|
||||
$tag = reset($tags);
|
||||
$this->assertEquals("Content on\n multiple lines.\n\n One more, after the break.", $tag->getDescription());
|
||||
}
|
||||
@@ -317,7 +317,7 @@ DOCBLOCK;
|
||||
/**
|
||||
* @depends testConstructWithTagsOnly
|
||||
* @covers \phpDocumentor\Reflection\DocBlock::getTagsByName
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetTagsByNameMultipleMatch()
|
||||
Reference in New Issue
Block a user