Annotation of embedaddon/php/ext/standard/tests/file/userstreams_006.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: User-space streams: set_options returns "not implemented" for unhandled option types
! 3: --FILE--
! 4: <?php
! 5: class test_wrapper {
! 6: function stream_open($path, $mode, $openedpath) {
! 7: return true;
! 8: }
! 9: function stream_eof() {
! 10: return false;
! 11: }
! 12: function stream_write($data) {
! 13: echo "size: ", strlen($data), "\n";
! 14: return strlen($data);
! 15: }
! 16: function stream_set_option($option, $arg1, $arg2) {
! 17: echo "option: ", $option, ", ", $arg1, ", ", $arg2, "\n";
! 18: return false;
! 19: }
! 20: }
! 21:
! 22: var_dump(stream_wrapper_register('test', 'test_wrapper'));
! 23:
! 24: $fd = fopen("test://foo","r");
! 25:
! 26: var_dump(stream_set_write_buffer($fd, 50));
! 27: var_dump(stream_set_chunk_size($fd, 42));
! 28:
! 29: var_dump(fwrite($fd, str_repeat('0', 70)));
! 30:
! 31: --EXPECT--
! 32: bool(true)
! 33: option: 3, 2, 50
! 34: int(-1)
! 35: int(8192)
! 36: size: 42
! 37: size: 28
! 38: int(70)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>