BetterReflectionTest\Reflection\ReflectionParameterTest::testDefaultParametersTypes PHP Метод

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

public testDefaultParametersTypes ( string $defaultExpression, mixed $expectedValue )
$defaultExpression string
$expectedValue mixed
    public function testDefaultParametersTypes($defaultExpression, $expectedValue)
    {
        $content = "<?php class Foo { public function myMethod(\$var = {$defaultExpression}) {} }";
        $reflector = new ClassReflector(new StringSourceLocator($content));
        $classInfo = $reflector->reflect('Foo');
        $methodInfo = $classInfo->getMethod('myMethod');
        $paramInfo = $methodInfo->getParameter('var');
        $actualValue = $paramInfo->getDefaultValue();
        $this->assertSame($expectedValue, $actualValue);
    }