BetterReflectionTest\TypesFinder\FindParameterTypeTest::testFindParameterTypeForMethod PHP Method

testFindParameterTypeForMethod() public method

public testFindParameterTypeForMethod ( string $docBlock, string $nodeName, string[] $expectedInstances )
$docBlock string
$nodeName string
$expectedInstances string[]
    public function testFindParameterTypeForMethod($docBlock, $nodeName, $expectedInstances)
    {
        $node = new ParamNode($nodeName);
        $docBlock = "/**\n * {$docBlock}\n */";
        $class = $this->createMock(ReflectionClass::class);
        $class->expects($this->once())->method('getLocatedSource')->will($this->returnValue(new LocatedSource('<?php', null)));
        $method = $this->createMock(ReflectionMethod::class);
        $method->expects($this->once())->method('getDocComment')->will($this->returnValue($docBlock));
        $method->expects($this->once())->method('getDeclaringClass')->will($this->returnValue($class));
        /* @var ReflectionMethod $method */
        $foundTypes = (new FindParameterType())->__invoke($method, $node);
        $this->assertCount(count($expectedInstances), $foundTypes);
        foreach ($expectedInstances as $i => $expectedInstance) {
            $this->assertInstanceOf($expectedInstance, $foundTypes[$i]);
        }
    }