|
19 | 19 | use phpDocumentor\Reflection\Fqsen;
|
20 | 20 | use phpDocumentor\Reflection\TypeResolver;
|
21 | 21 | use phpDocumentor\Reflection\Types\Array_;
|
| 22 | +use phpDocumentor\Reflection\Types\Boolean; |
22 | 23 | use phpDocumentor\Reflection\Types\Compound;
|
23 | 24 | use phpDocumentor\Reflection\Types\Context;
|
| 25 | +use phpDocumentor\Reflection\Types\Float_; |
24 | 26 | use phpDocumentor\Reflection\Types\Integer;
|
25 | 27 | use phpDocumentor\Reflection\Types\Mixed_;
|
26 | 28 | use phpDocumentor\Reflection\Types\Object_;
|
@@ -698,4 +700,41 @@ public function testCreateWithReference(): void
|
698 | 700 | $this->assertSame($description, $fixture->getDescription());
|
699 | 701 | $this->assertTrue($fixture->returnsReference());
|
700 | 702 | }
|
| 703 | + |
| 704 | + /** |
| 705 | + * @uses \phpDocumentor\Reflection\DocBlock\Tags\MethodParameter::__construct |
| 706 | + * @uses \phpDocumentor\Reflection\DocBlock\Tags\MethodParameter::getDefaultValue() |
| 707 | + * @uses \phpDocumentor\Reflection\DocBlock\Tags\MethodParameter::__toString |
| 708 | + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter |
| 709 | + * |
| 710 | + * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render |
| 711 | + * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName |
| 712 | + */ |
| 713 | + public function testIfTagCanBeRenderedUsingMethodParameterWithDefaultValue(): void |
| 714 | + { |
| 715 | + $arguments = [ |
| 716 | + ['name' => 'argument1', 'type' => new String_()], |
| 717 | + ['name' => 'argument2', 'type' => new Object_()], |
| 718 | + ]; |
| 719 | + |
| 720 | + $fixture = new Method( |
| 721 | + 'myMethod', |
| 722 | + $arguments, |
| 723 | + new Void_(), |
| 724 | + false, |
| 725 | + null, |
| 726 | + false, |
| 727 | + [ |
| 728 | + new MethodParameter('argument1', new String_(), false, false, '1'), |
| 729 | + new MethodParameter('argument2', new Integer(), false, false, '1'), |
| 730 | + new MethodParameter('argument3', new Boolean(), false, false, 'true'), |
| 731 | + new MethodParameter('argument4', new Float_(), false, false, '1.23'), |
| 732 | + ] |
| 733 | + ); |
| 734 | + |
| 735 | + $this->assertSame( |
| 736 | + '@method void myMethod(string $argument1 = \'1\', int $argument2 = 1, bool $argument3 = true, float $argument4 = 1.23)', |
| 737 | + $fixture->render() |
| 738 | + ); |
| 739 | + } |
701 | 740 | }
|
0 commit comments