Annotation of embedaddon/php/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test stream_get_meta_data() function : error conditions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : proto array stream_get_meta_data(resource fp)
! 6: * Description: Retrieves header/meta data from streams/file pointers
! 7: * Source code: ext/standard/streamsfuncs.c
! 8: * Alias to functions: socket_get_status
! 9: */
! 10:
! 11: echo "*** Testing stream_get_meta_data() : error conditions ***\n";
! 12:
! 13: // Zero arguments
! 14: echo "\n-- Testing stream_get_meta_data() function with Zero arguments --\n";
! 15: var_dump( stream_get_meta_data() );
! 16:
! 17: //Test stream_get_meta_data with one more than the expected number of arguments
! 18: echo "\n-- Testing stream_get_meta_data() function with more than expected no. of arguments --\n";
! 19:
! 20: $fp = null;
! 21: $extra_arg = 10;
! 22: var_dump( stream_get_meta_data($fp, $extra_arg) );
! 23:
! 24: echo "\n-- Testing stream_get_meta_data() function with invalid stream resource --\n";
! 25: $fp = null;
! 26: var_dump(stream_get_meta_data($fp));
! 27:
! 28: echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n";
! 29: $fp = fopen(__FILE__, 'r');
! 30: fclose($fp);
! 31: var_dump(stream_get_meta_data($fp));
! 32:
! 33: echo "Done";
! 34: ?>
! 35: --EXPECTF--
! 36: *** Testing stream_get_meta_data() : error conditions ***
! 37:
! 38: -- Testing stream_get_meta_data() function with Zero arguments --
! 39:
! 40: Warning: stream_get_meta_data() expects exactly 1 parameter, 0 given in %s on line %i
! 41: NULL
! 42:
! 43: -- Testing stream_get_meta_data() function with more than expected no. of arguments --
! 44:
! 45: Warning: stream_get_meta_data() expects exactly 1 parameter, 2 given in %s on line %i
! 46: NULL
! 47:
! 48: -- Testing stream_get_meta_data() function with invalid stream resource --
! 49:
! 50: Warning: stream_get_meta_data() expects parameter 1 to be resource, null given in %s on line %i
! 51: NULL
! 52:
! 53: -- Testing stream_get_meta_data() function with closed stream resource --
! 54:
! 55: Warning: stream_get_meta_data(): %i is not a valid stream resource in %s on line %i
! 56: bool(false)
! 57: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>