|
17 | 17 | use phpDocumentor\Reflection\DocBlock\Tags\Formatter;
|
18 | 18 | use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter;
|
19 | 19 | use phpDocumentor\Reflection\DocBlock\Tags\Generic;
|
| 20 | +use phpDocumentor\Reflection\DocBlock\Tags\Return_; |
20 | 21 | use phpDocumentor\Reflection\DocBlock\Tags\See;
|
21 | 22 | use phpDocumentor\Reflection\Fqsen;
|
22 | 23 | use phpDocumentor\Reflection\FqsenResolver;
|
| 24 | +use phpDocumentor\Reflection\TypeResolver; |
23 | 25 | use phpDocumentor\Reflection\Types\Context;
|
24 | 26 |
|
25 | 27 | /**
|
@@ -322,4 +324,38 @@ public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementThe
|
322 | 324 |
|
323 | 325 | $tagFactory->registerTagHandler('my-tag', 'stdClass');
|
324 | 326 | }
|
| 327 | + |
| 328 | + /** |
| 329 | + * @covers ::create |
| 330 | + * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct |
| 331 | + * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService |
| 332 | + * @uses phpDocumentor\Reflection\Docblock\Description |
| 333 | + * @uses phpDocumentor\Reflection\Docblock\Tags\Return_ |
| 334 | + * @uses phpDocumentor\Reflection\Docblock\Tags\BaseTag |
| 335 | + */ |
| 336 | + public function testReturntagIsMappedCorrectly() |
| 337 | + { |
| 338 | + $context = new Context(''); |
| 339 | + |
| 340 | + $descriptionFactory = m::mock(DescriptionFactory::class); |
| 341 | + $descriptionFactory |
| 342 | + ->shouldReceive('create') |
| 343 | + ->once() |
| 344 | + ->with('', $context) |
| 345 | + ->andReturn(new Description('')) |
| 346 | + ; |
| 347 | + |
| 348 | + $typeResolver = new TypeResolver(); |
| 349 | + |
| 350 | + $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); |
| 351 | + $tagFactory->addService($descriptionFactory, DescriptionFactory::class); |
| 352 | + $tagFactory->addService($typeResolver, TypeResolver::class); |
| 353 | + |
| 354 | + |
| 355 | + /** @var Return_ $tag */ |
| 356 | + $tag = $tagFactory->create('@return mixed', $context); |
| 357 | + |
| 358 | + $this->assertInstanceOf(Return_::class, $tag); |
| 359 | + $this->assertSame('return', $tag->getName()); |
| 360 | + } |
325 | 361 | }
|
0 commit comments