Skip to content

Commit 8727095

Browse files
danrotmvriel
authored andcommitted
Add failing testcase for long method name
1 parent e2ce1d2 commit 8727095

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/unit/DocBlock/Tags/MethodTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,37 @@ public function testReturnTypeThis() : void
342342
$this->assertInstanceOf(This::class, $fixture->getReturnType());
343343
}
344344

345+
/**
346+
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
347+
* @uses \phpDocumentor\Reflection\TypeResolver
348+
* @uses \phpDocumentor\Reflection\DocBlock\Description
349+
* @uses \phpDocumentor\Reflection\Types\Context
350+
*
351+
* @covers ::create
352+
*/
353+
public function testReturnTypeNoneWithLongMethodName() : void
354+
{
355+
$descriptionFactory = m::mock(DescriptionFactory::class);
356+
$resolver = new TypeResolver();
357+
$context = new Context('');
358+
359+
$description = new Description('');
360+
361+
$descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description);
362+
363+
$fixture = Method::create(
364+
'myVeryLongMethodName($node)',
365+
$resolver,
366+
$descriptionFactory,
367+
$context
368+
);
369+
370+
$this->assertFalse($fixture->isStatic());
371+
$this->assertSame('void myVeryLongMethodName(mixed $node)', (string) $fixture);
372+
$this->assertSame('myVeryLongMethodName', $fixture->getMethodName());
373+
$this->assertInstanceOf(Void_::class, $fixture->getReturnType());
374+
}
375+
345376
/**
346377
* @return string[][]
347378
*/

0 commit comments

Comments
 (0)