mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-17 17:47:13 +00:00
"See" -> add more test + simplify the regex
This commit is contained in:
@@ -59,7 +59,7 @@ final class See extends BaseTag implements Factory\StaticMethod
|
||||
$description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null;
|
||||
|
||||
// https://tools.ietf.org/html/rfc2396#section-3
|
||||
if (preg_match('/\w:\/\/\w/i', $parts[0])) {
|
||||
if (preg_match('#\w://\w#', $parts[0])) {
|
||||
return new static(new Url($parts[0]), $description);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,9 @@ 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\DocBlock\Tags\Reference\Fqsen as FqsenRef;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen as TagsFqsen;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Reference\Url as UrlRef;
|
||||
use phpDocumentor\Reflection\Fqsen;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
@@ -251,6 +253,36 @@ class SeeTest extends TestCase
|
||||
$this->assertSame($description, $fixture->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\See::<public>
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
|
||||
* @uses \phpDocumentor\Reflection\FqsenResolver
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\Description
|
||||
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url
|
||||
* @uses \phpDocumentor\Reflection\Types\Context
|
||||
*
|
||||
* @covers ::create
|
||||
*/
|
||||
public function testFactoryMethodWithoutUrl() : void
|
||||
{
|
||||
$fqsenResolver = new FqsenResolver();
|
||||
$tagFactory = new StandardTagFactory($fqsenResolver);
|
||||
$descriptionFactory = new DescriptionFactory($tagFactory);
|
||||
$context = new Context('');
|
||||
|
||||
$fixture = See::create(
|
||||
'Foo My Description ',
|
||||
$fqsenResolver,
|
||||
$descriptionFactory,
|
||||
$context
|
||||
);
|
||||
|
||||
$this->assertSame('\Foo My Description ', (string) $fixture);
|
||||
$this->assertInstanceOf(TagsFqsen::class, $fixture->getReference());
|
||||
$this->assertSame('\Foo', (string) $fixture->getReference());
|
||||
$this->assertSame('My Description ', $fixture->getDescription() . '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::create
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user