Skip to content

Commit 8bcaf35

Browse files
authored
Add unittest
1 parent 6e08ea5 commit 8bcaf35

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/unit/TypeResolverTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,37 @@ public function testResolvingCompoundTypes() : void
251251
$this->assertInstanceOf(Fqsen::class, $secondType->getFqsen());
252252
}
253253

254+
/**
255+
* @uses \phpDocumentor\Reflection\Types\Context
256+
* @uses \phpDocumentor\Reflection\Types\Compound
257+
* @uses \phpDocumentor\Reflection\Types\String_
258+
* @uses \phpDocumentor\Reflection\Types\Object_
259+
* @uses \phpDocumentor\Reflection\Fqsen
260+
* @uses \phpDocumentor\Reflection\FqsenResolver
261+
*
262+
* @covers ::__construct
263+
* @covers ::resolve
264+
* @covers ::<private>
265+
*/
266+
public function testResolvingAmpersandCompoundTypes() : void
267+
{
268+
$fixture = new TypeResolver();
269+
270+
$resolvedType = $fixture->resolve('Reflection\DocBlock&\PHPUnit\Framework\MockObject\MockObject ', new Context('phpDocumentor'));
271+
272+
$this->assertInstanceOf(Compound::class, $resolvedType);
273+
$this->assertSame('\phpDocumentor\Reflection\DocBlock&\PHPUnit\Framework\MockObject\MockObject', (string) $resolvedType);
274+
275+
$firstType = $resolvedType->get(0);
276+
277+
$secondType = $resolvedType->get(1);
278+
279+
$this->assertInstanceOf(Object_::class, $firstType);
280+
$this->assertInstanceOf(Fqsen::class, $firstType->getFqsen());
281+
$this->assertInstanceOf(Object_::class, $secondType);
282+
$this->assertInstanceOf(Fqsen::class, $secondType->getFqsen());
283+
}
284+
254285
/**
255286
* @uses \phpDocumentor\Reflection\Types\Context
256287
* @uses \phpDocumentor\Reflection\Types\Compound

0 commit comments

Comments
 (0)