Annotation of embedaddon/php/ext/reflection/tests/bug29523.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Reflection Bug #29523 (ReflectionParameter::isOptional() is incorrect)
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: class TestClass
        !             7: {
        !             8: }
        !             9: 
        !            10: function optionalTest(TestClass $a, TestClass $b, $c = 3)
        !            11: {
        !            12: }
        !            13: 
        !            14: $function = new ReflectionFunction('optionalTest'); 
        !            15: $numberOfNotOptionalParameters = 0;
        !            16: $numberOfOptionalParameters = 0;
        !            17: foreach($function->getParameters() as $parameter)
        !            18: {
        !            19:        var_dump($parameter->isOptional());
        !            20:        if ($parameter->isOptional())
        !            21:        {
        !            22:                ++$numberOfOptionalParameters;
        !            23:        }
        !            24:        else
        !            25:        {
        !            26:                ++$numberOfNotOptionalParameters;
        !            27:        }
        !            28: }
        !            29: var_dump($function->getNumberOfRequiredParameters());
        !            30: var_dump($numberOfNotOptionalParameters);
        !            31: 
        !            32: ?>
        !            33: --EXPECT--
        !            34: bool(false)
        !            35: bool(false)
        !            36: bool(true)
        !            37: int(2)
        !            38: int(2)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>