BetterReflectionTest\TypesFinder\FindParameterTypeTest::testFindParameterTypeForFunction PHP Method

testFindParameterTypeForFunction() public method

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