Annotation of embedaddon/php/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test ReflectionFunction::getClosure() function : basic functionality
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : public mixed ReflectionFunction::getClosure()
! 6: * Description: Returns a dynamically created closure for the function
! 7: * Source code: ext/reflection/php_reflection.c
! 8: * Alias to functions:
! 9: */
! 10:
! 11: echo "*** Testing ReflectionFunction::getClosure() : basic functionality ***\n";
! 12:
! 13: function foo()
! 14: {
! 15: var_dump( "Inside foo function" );
! 16: }
! 17:
! 18: function bar( $arg )
! 19: {
! 20: var_dump( "Arg is " . $arg );
! 21: }
! 22:
! 23: $func = new ReflectionFunction( 'foo' );
! 24: $closure = $func->getClosure();
! 25: $closure();
! 26:
! 27: $func = new ReflectionFunction( 'bar' );
! 28: $closure = $func->getClosure();
! 29: $closure( 'succeeded' );
! 30:
! 31: ?>
! 32: ===DONE===
! 33: --EXPECTF--
! 34: *** Testing ReflectionFunction::getClosure() : basic functionality ***
! 35: string(19) "Inside foo function"
! 36: string(16) "Arg is succeeded"
! 37: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>