Skip to content

Commit 5a2dd88

Browse files
committed
"Link" -> add some more tests
1 parent 3b4c4d1 commit 5a2dd88

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

tests/unit/DocBlock/Tags/LinkTest.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Mockery as m;
1717
use phpDocumentor\Reflection\DocBlock\Description;
1818
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
19+
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
20+
use phpDocumentor\Reflection\Fqsen;
21+
use phpDocumentor\Reflection\FqsenResolver;
1922
use phpDocumentor\Reflection\Types\Context;
2023
use PHPUnit\Framework\TestCase;
2124

@@ -163,6 +166,60 @@ public function testFactoryMethod() : void
163166
$this->assertSame($description, $fixture->getDescription());
164167
}
165168

169+
/**
170+
* @uses \phpDocumentor\Reflection\DocBlock\Tags\See::<public>
171+
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
172+
* @uses \phpDocumentor\Reflection\FqsenResolver
173+
* @uses \phpDocumentor\Reflection\DocBlock\Description
174+
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url
175+
* @uses \phpDocumentor\Reflection\Types\Context
176+
*
177+
* @covers ::create
178+
*/
179+
public function testFactoryMethodWithoutSpaceBeforeUrl() : void
180+
{
181+
$fqsenResolver = new FqsenResolver();
182+
$tagFactory = new StandardTagFactory($fqsenResolver);
183+
$descriptionFactory = new DescriptionFactory($tagFactory);
184+
$context = new Context('');
185+
186+
$fixture = Link::create(
187+
'http://this.is.my/link My Description ',
188+
$descriptionFactory,
189+
$context
190+
);
191+
192+
$this->assertSame('http://this.is.my/link My Description ', (string) $fixture);
193+
$this->assertSame('My Description ', $fixture->getDescription() . '');
194+
}
195+
196+
/**
197+
* @uses \phpDocumentor\Reflection\DocBlock\Tags\See::<public>
198+
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
199+
* @uses \phpDocumentor\Reflection\FqsenResolver
200+
* @uses \phpDocumentor\Reflection\DocBlock\Description
201+
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url
202+
* @uses \phpDocumentor\Reflection\Types\Context
203+
*
204+
* @covers ::create
205+
*/
206+
public function testFactoryMethodWithSpaceBeforeUrl() : void
207+
{
208+
$fqsenResolver = new FqsenResolver();
209+
$tagFactory = new StandardTagFactory($fqsenResolver);
210+
$descriptionFactory = new DescriptionFactory($tagFactory);
211+
$context = new Context('');
212+
213+
$fixture = Link::create(
214+
' http://this.is.my/link My Description ',
215+
$descriptionFactory,
216+
$context
217+
);
218+
219+
$this->assertSame('http://this.is.my/link My Description ', (string) $fixture);
220+
$this->assertSame('http://this.is.my/link My Description ', $fixture->getDescription() . '');
221+
}
222+
166223
/**
167224
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Link::<public>
168225
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory

0 commit comments

Comments
 (0)