BetterReflectionTest\TypesFinder\FindPropertyTypeTest::testFindPropertyType PHP Метод

testFindPropertyType() публичный Метод

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